1
I have the Hack for Mass delete inactive users , But the only one can run the Hack is the webmaster , How i give another user from another Group the permission to Run the Hack too .. this the Hack code
include "mainfile.php";
include "header.php";
if ( (!is_object($xoopsUser) || !$xoopsUser->isAdmin())) {
redirect_header(XOOPS_URL, 2, _NOPERM);
exit();
}
include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php";
if (isset($_POST['submit'])) {
if ( file_exists(XOOPS_ROOT_PATH."/language/".$GLOBALS['xoopsConfig']['language']."/user.php") ) {
include_once XOOPS_ROOT_PATH."/language/".$GLOBALS['xoopsConfig']['language']."/user.php";
} else {
include_once XOOPS_ROOT_PATH."/language/english/user.php";
}
$days= trim($_REQUEST['days']);
$member_handler = xoops_gethandler('member');
$criteria = new Criteria("level", 0); //target inactive users
$users = $member_handler->getUsers($criteria);
$delete_regdate= time() - ( $days * 24 * 60 * 60 ); // X days/month * 24 hrs/day
if (empty($users)){
echo _US_SORRYNOTFOUND;
}
foreach (array_keys($users) as $i) {
if ($users[$i]->getVar('user_regdate') < $delete_regdate){ //all users whose register more than X days ago
if ($member_handler->deleteUser($users[$i]) ) {
echo $users[$i]->getVar('uname')." "._US_BEENDELED."
";
} else {
echo "Could not delete ".$users[$i]->getVar('uname')."
";
}
} else {
echo $users[$i]->getVar('uname')." is inactived but registered Less than ".$days." days ago"."
";
}
}
$form = new XoopsThemeForm('', 'form', 'delete_users.php');
$form->addElement(new XoopsFormButton('', '', _BACK, 'submit'));
$form->display();
}
elseif( trim($_REQUEST['days']) == "") {
$form = new XoopsThemeForm('Warning !!!:All inactive users whose registered more than X days ago WILL BE DELETED FROM DATABASE', 'form', 'delete_users.php');
$form ->addElement(new XoopsFormText('Input number of days (leave it blank if you want delete all inactive users):','days',25,255));
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
$form->display();
}
include "footer.php"
?>
Whatever Hits You , Never was to Mess you , and Whatever Messed U , Never Was to Hit You.