本文整理匯總了PHP中Network::leave_all_networks方法的典型用法代碼示例。如果您正苦於以下問題:PHP Network::leave_all_networks方法的具體用法?PHP Network::leave_all_networks怎麽用?PHP Network::leave_all_networks使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Network
的用法示例。
在下文中一共展示了Network::leave_all_networks方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: delete
/**
* Delete the user from the system
*
* User data is never 'hard deleted' from the database. Instead the 'is_active' flag is set to 1
*
*/
public static function delete($user_id, $true_delete = FALSE)
{
Logger::log("Enter: function User::delete");
// check whether user is already deleted
if ($true_delete) {
$sql = 'SELECT * from {users} WHERE user_id=?';
$data = array($user_id);
} else {
$sql = 'SELECT * from {users} WHERE user_id=? AND is_active = ?';
$data = array($user_id, DELETED);
}
$res = Dal::query($sql, $data);
if ($res->numRows() > 0 && !$true_delete) {
Logger::log("Throwing exception USER_ALREADY_DELETED | message: Can not delete a deleted user");
throw new PAException(USER_ALREADY_DELETED, "Can not delete a deleted user.");
} else {
if ($true_delete) {
$sql = 'DELETE FROM {users} WHERE user_id = ?';
$sql1 = 'DELETE FROM {user_profile_data} WHERE user_id = ?';
$data = array($user_id);
$res = Dal::query($sql, $data);
$res = Dal::query($sql1, $data);
} else {
$sql = 'UPDATE {users} SET login_name = CONCAT(?, login_name), email = CONCAT(?, email), is_active = ? WHERE user_id = ?';
$data = array(MARK_DELETED_USER . $user_id . MARK_DELETED_USER, MARK_DELETED_USER . $user_id . MARK_DELETED_USER, DELETED, $user_id);
//updated login_name will be of the kind #17#gurpreet.Here 17 is the user_id, gurpreet is login_name and
# is serving as delimiter.
$res = Dal::query($sql, $data);
}
}
// make sure there aren't any lingering entries in networks_users or groups_users
Network::leave_all_networks($user_id);
Group::leave_all_groups($user_id);
Logger::log("Exit: function User::delete");
}