function resign(&$flag, &$controller, &$xoopsUser)
 {
     $handler =& xoops_gethandler('member');
     $groups = $handler->getGroupsByUser($xoopsUser->get('uid'));
     foreach ($groups as $group) {
         $handler->removeUserFromGroup($group, $xoopsUser->get('uid'));
     }
     $handler->addUserToGroup(RESIGN_USER_GROUP_ID, $xoopsUser->get('uid'));
     xoops_notification_deletebyuser($xoopsUser->get('uid'));
     XCube_DelegateUtils::call('Legacy.Event.UserDelete', new XCube_Ref($xoopsUser));
     $flag = true;
     $root =& XCube_Root::getSingleton();
     // Reset session
     $_SESSION = array();
     $root->mSession->destroy(true);
     // reset online
     $handler =& xoops_gethandler('online');
     $handler->destroy($xoopsUser->get('uid'));
     xoops_notification_deletebyuser($xoopsUser->get('uid'));
     // Redirect not to call behind delegates.
     $langMgr =& $root->getLanguageManager();
     $langMgr->loadPageTypeMessageCatalog('user');
     $controller =& $root->getController();
     $controller->executeRedirect(XOOPS_URL, 3, _US_BEENDELED);
 }
Example #2
0
     if (@isset($_REQUEST['memberslist_id']) || @$_REQUEST['memberslist_id'] != '') {
         $xoBreadCrumb->render();
         $error = '';
         foreach ($_REQUEST['memberslist_id'] as $del) {
             $del = intval($del);
             $user =& $member_handler->getUser($del);
             $groups = $user->getGroups();
             if (in_array(XOOPS_GROUP_ADMIN, $groups)) {
                 $error .= sprintf(_AM_SYSTEM_USERS_NO_ADMINSUPP, $user->getVar("uname"));
             } elseif (!$member_handler->deleteUser($user)) {
                 $error .= sprintf(_AM_SYSTEM_USERS_NO_SUPP, $user->getVar("uname"));
             } else {
                 $online_handler =& xoops_gethandler('online');
                 $online_handler->destroy($del);
                 // RMV-NOTIFY
                 xoops_notification_deletebyuser($del);
             }
         }
         if ($error != '') {
             redirect_header("admin.php?fct=users", 3, sprintf(_AM_SYSTEM_USERS_ERROR, $error));
         } else {
             redirect_header("admin.php?fct=users", 1, _AM_SYSTEM_DBUPDATED);
         }
     }
     break;
     // Save user
 // Save user
 case "users_save":
     global $xoopsConfig, $xoopsModule, $xoopsUser;
     if (isset($_REQUEST['uid'])) {
         //Update user
 /**
  * Exection deleting.
  * 
  * @return bool
  */
 function _doDelete(&$flag, $controller, $xoopsUser)
 {
     $handler =& xoops_gethandler('member');
     if ($handler->deleteUser($xoopsUser)) {
         $handler =& xoops_gethandler('online');
         $handler->destroy($this->mObject->get('uid'));
         xoops_notification_deletebyuser($this->mObject->get('uid'));
         $flag = true;
     }
     $flag |= false;
 }
Example #4
0
function delete_users()
{
    global $xoopsSecurity;
    if (!$xoopsSecurity->check()) {
        redirectMsg("users.php", implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()), 1);
        die;
    }
    foreach ($_GET as $k => $v) {
        if ($k == 'XOOPS_TOKEN_REQUEST' || $k == 'action') {
            continue;
        }
        $q .= $q == '' ? "{$k}=" . urlencode($v) : "&{$k}=" . urlencode($v);
    }
    $uid = rmc_server_var($_POST, 'ids', array());
    $member_handler =& xoops_gethandler('member', 'system');
    foreach ($uid as $id) {
        $user =& $member_handler->getUser($id);
        $groups = $user->getGroups();
        if (in_array(XOOPS_GROUP_ADMIN, $groups)) {
            xoops_error(sprintf(__('Admin user cannot be deleted: %s', 'rmcommon'), $user->getVar("uname") . '<br />'));
        } elseif (!$member_handler->deleteUser($user)) {
            xoops_error(sprintf(__('User cannot be deleted: %s', 'rmcommon'), $user->getVar("uname") . '<br />'));
        } else {
            $online_handler =& xoops_gethandler('online');
            $online_handler->destroy($uid);
            // RMV-NOTIFY
            xoops_notification_deletebyuser($uid);
        }
    }
    redirectMsg("users.php?" . $q, __('Users deleted successfully!', 'rmcommon'), 0);
}