MyBB Hacks

Full Version: Please help me with a conditional
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Please help I want to show a code on users profile and postbit section when the user is a top poster, what conditional will do that please?

In other words if the user show in stats as today top poster I want the conditional that will show a code on postbit and user profile please help me!

Update:

So I have this code that gets today top poster not is it possible to use templates conditional to show a message on post bit and user profile when the user is returned by this code as top poster?

PHP Code:
function today()
{
    global $db, $mybb, $today_today;
    
        $todaytime = TIME_NOW - 86400;
        $query = $db->query("SELECT u.uid,u.username,u.displaygroup,u.usergroup,u.avatar,COUNT(*) AS ptoday FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."users u ON (p.uid=u.uid) WHERE p.dateline > $todaytime GROUP BY p.uid ORDER BY ptoday DESC LIMIT 1");
        $today_today = '<table border="0" cellspacing="0" cellpadding="0" width="100%">';
        while($user = $db->fetch_array($query))
        {
            $posts = $user['ptoday'];
            if($user['avatar'] != '')
            {
                $user['avatar'] = $user['avatar'];
            }
            else
            {
                $user['avatar'] = "./images/default_avatar.gif";
            }
            
            $userlink = build_profile_link($user['username'], $user['uid']);
            $user['username'] = format_name($user['username'], $user['usergroup'], $user['displaygroup']);
                $ava = '<img src="'.$user['avatar'].'" 	width="42px" height="42px">';
                $today_today .= '<tr><td 	width="50px">'.$ava.'</td><td align="left">'.$userlink.'</td><td align="left">'.$posts.'</td></tr>';
            }
        $today_today .= '</table>';
        
    }

MyBB has no inbuilt idea of a "top poster", so you cannot use conditionals to get it.
You need PHP code to perform a query (as above) to get this information.
Oh I didn't know that thanks very much
Reference URL's