Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Please help me with a conditional
letsforum Offline
Junior Member
**
Posts: 36
Joined: Sep 2013
Post: #1
Please help me with a conditional
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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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>';
        
    }


Internet marketing and SEO forum - http://letsforum.com
(This post was last modified: 01-19-2014 02:22 AM by letsforum.)
01-19-2014 12:05 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #2
RE: Please help me with a conditional
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.

My Blog
01-21-2014 10:05 AM
Find all posts by this user Quote this message in a reply
letsforum Offline
Junior Member
**
Posts: 36
Joined: Sep 2013
Post: #3
RE: Please help me with a conditional
Oh I didn't know that thanks very much

Internet marketing and SEO forum - http://letsforum.com
01-26-2014 03:19 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: