本文整理汇总了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");
}