1
Dave_L
Inactivated Users block
  • 2005/12/9 18:31

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


[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_USERStrue);

$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') > 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 
"
        <table>
        <tr class='head'>
            <td class='head'>Username</td>
            <td>Date registered</td>
        </tr>
    "
;
    
    
$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 
"
            <tr class='
$class'>
                <td class='
$class'><a href='$profile_link'>$uname</a></td>
                <td>
$regdate</td>
            </tr>
        "
;
    }
    
    echo 
"
        </table>
    "
;

} 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

2
menochi
Re: Inactivated Users block
  • 2005/12/9 22:55

  • menochi

  • Friend of XOOPS

  • Posts: 259

  • Since: 2003/12/28


Hello Dave_L

that is a nice new block. Thank you for share it with us.
in valid code we trust

3
artigas
Re: Inactivated Users block
  • 2005/12/16 16:40

  • artigas

  • Quite a regular

  • Posts: 208

  • Since: 2004/12/21


Greetings Dave_L -

Thank you for this block.
Regards,
Roberto Artigas
If you move one grain of sand at a time to the same location eventually you will create a mountain.

Login

Who's Online

233 user(s) are online (155 user(s) are browsing Support Forums)


Members: 0


Guests: 233


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits