1
[XOOPS 2.2.3a-final]
This isn't really a hack, but I couldn't find a better place to post it.
It's a custom block that displays inactivated users (users who have registered but not yet been activated). It allows a webmaster to review or edit their profiles prior to activating them.
// Content for block to display registered but inactivated users.
$member_handler =& xoops_gethandler('member');
$users = $member_handler->getUsersByGroup(XOOPS_GROUP_USERS, true);
$inactivated_users = array();
foreach ($users as $user) {
// The check for uid > 0 avoids getting a bogus user profile.
// (I don't understand why that happens.)
if ($user->getVar('uid') > 0 and $user->getVar('level') == 0) {
// Use registration date as array key, so that array can be sorted below.
$inactivated_users[$user->getVar('user_regdate')] = $user;
}
}
if (!empty($inactivated_users)) {
// Sort by registration date descending.
krsort($inactivated_users);
echo "
Username |
Date registered |
";
$class = 'odd';
foreach ($inactivated_users as $user) {
$uid = $user->getVar('uid');
$uname = $user->getVar('uname');
$profile_link = XOOPS_URL . "/modules/profile/admin/user.php?op=edit&id=$uid";
$regdate = formatTimestamp($user->getVar('user_regdate'), 'm');
$class = ($class == 'odd') ? 'even' : 'odd';
echo "
$class'>
$class'>$profile_link'>$uname |
$regdate |
";
}
echo "
";
} else {
echo 'None';
}
The block content type is PHP Script.
On the site for which I wrote this, I located the block on the admin index page, and made it visible only to webmasters. I used the title "Inactivated Users". I also added the following note in modules/profile/language/english/mail_template/adminactivate.tpl:
Quote:
Before activating this account, you may wish to review or edit the user's profile.
You can do that from the Inactivated Users block at {SITEURL}admin.php