MyBB Community Forums

Full Version: Variable for Newest Member
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Does anyone know the variable for the newest registered member?
I'm also in the need for this! Hopefully someone can help us Big Grin
$newestmember build_profile_link($mybb->user['username'], $mybb->user['uid'])

Just a guess.
(2012-05-19, 11:34 PM)Solidus Wrote: [ -> ]
$newestmember build_profile_link($mybb->user['username'], $mybb->user['uid'])

Just a guess.

That doesn't work if I put it into a template. What should I wrap the code in?
You will need a plugin to read the cache and build a ready-to-use variable for templates.

You will need x hook depending in where you want to show it.
function getNewestMember()
{
    global $db;
    $query = $db->query('SELECT uid FROM mybb_users ORDER BY uid DESC LIMIT 1');
    $query = $db->fetch_array( $query );
    return get_user( $query['uid'] );
}

$newest = getNewestMember();
echo $newest['username'];
I want to show on the footer..

Latest Member {$newest['username']}

or something.

What would be the correct code?
Try:

{$newestmember}
(2012-05-20, 06:52 AM)CAwesome Wrote: [ -> ]
function getNewestMember()
{
    global $db;
    $query = $db->query('SELECT uid FROM mybb_users ORDER BY uid DESC LIMIT 1');
    $query = $db->fetch_array( $query );
    return get_user( $query['uid'] );
}

$newest = getNewestMember();
echo $newest['username'];

You don't need two queries since last user data is already in the stats cache.
No db queries at all Wink

Install plugin and add "newbiemember" (without quotes) to footer
Pages: 1 2