MyBB Community Forums

Full Version: show how mach user viewed subforum?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
i need in the forum index page show how may user viewed a subforum. see image.
I would love to have them. That is awesome though.
Hello there,

Open index.php

Find

PHP Code:
                    eval("\$forumlisting .= \"".$templates->get("forumbit_depth$depth$forumcat")."\";"); 

Above it add

PHP Code:
global $db;
    
$timecut time() - $mybb->settings['wolcutoff'];
    
$guestcount 0;
    
$membercount 0;
    
$inviscount 0;
    
$viewscount 0;
        
$query $db->query("SELECT uid FROM ".TABLE_PREFIX."sessions WHERE location1='$fid' AND time>'$timecut'");
    while(
$user $db->fetch_array($query))
    {
        if(
$user['uid'] == 0)
        {
            
$guestcount++;
        }
        else
        {
            if(
$doneusers[$user['uid']] < $user['time'] || !$doneusers[$user['uid']])
            {
                
$doneusers[$user['uid']] = $user['time'];
                
$membercount++;
                if(
$user['invisible'] != "yes" || $mybb->usergroup['canviewwolinvis'] =="yes")
                {
                    if(
$user['invisible'] == "yes")
                    {
                        
$inviscount++;
                    }

                }
            }
        }
    }
    
$viewscount $guestcount $membercount $inviscount;�� 

now in the forumbit_depth2_forum template
find
Code:
<strong><a href="forumdisplay.php?fid=$forum[fid]">$forum[name] </a></strong>
Replace with
Code:
<strong><a href="forumdisplay.php?fid=$forum[fid]">$forum[name] </a></strong> ($viewscount viewing)
beside the forum title.

regards
There's a mod for that purpose: http://mods.mybboard.com/view.php?did=153
Thanks Michael83
is it working on 1.1 Confused coz i have made my ownTounguelol while replying to this subject and it is packaged etc.. :/
however mine has some extra features for example you may customize the look of the message from the settings part whithout having to edit the code.

If i see some interested i will release it Smile
Yes it works on 1.1.1 Smile
Thank you Michael83.
very good.
Well this is howmany people viewed the forum is there any possiblity to show realtime viewings
Pages: 1 2