MyBB Community Forums

Full Version: translate the users viewing this thread-mod
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi,
my board is in dutch and I like the users viewing this thread mod. It works fine, the only problem is that I can't translate the text.

Copy of the code:
PHP Code:
// Start - Users viewing this thread
if($settings['viewingthisthread'] != "off")
{
    
$timecut time() - $settings['wolcutoff'];
    
$comma "";
    
$guestcount 0;
    
$membercount 0;
    
//$query = $db->query("SELECT DISTINCT o.ip, o.uid, o.time, u.username, u.usergroup, u.invisible, g.namestyle FROM ".TABLE_PREFIX."online o LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=o.uid) LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=u.usergroup) WHERE o.time>'$timecut' AND location LIKE '%showthread.php%tid=$tid%' ORDER BY u.username");
    
$query $db->query("SELECT DISTINCT o.ip, o.uid, o.time, u.username, u.usergroup `u.invisible`, g.namestyle FROM ".TABLE_PREFIX."online o LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=o.uid) LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=u.usergroup) WHERE o.time>'$timecut' AND location LIKE '%showthread.php?tid=$tid%' ORDER BY u.username");
    while(
$user $db->fetch_array($query))
    {
        if(
$user['uid'] == 0)
        {
            
$guestcount++;
        }
        else
        {
            if(
$doneusers[$user['uid']] < $user['time'] || !$doneusers)
            {
                
$doneusers[$user['uid']] = $user['time'];
                
$membercount++;
                if(
$user['invisible'] != "yes" || $mybbuser['canviewwolinvis'])
                {
                    if(
$user['invisible'] == "yes")
                    {
                        
$invisiblemark "*";
                    }
                    else
                    {
                        
$invisiblemark "";
                    }
                    
$user['username'] = formatname($user['username'], $user['namestyle']);
                    eval(
"\\$usersviewing .= \\"".$templates->get("showthread_usersviewing_user")."";");
                    
$comma ", ";
                }
            }
        }
    }
    if(
$guestcount) {
        eval(
"\\$guestsviewing .= \\"".$templates->get("showthread_usersviewing_guest")."";");
    }
    if(
$guestcount && $usersviewing) {
        
$viewingsep ", and";
    }
    eval(
"\\$usersviewing = \\"".$templates->get("showthread_usersviewing")."";");
    unset(
$comma);
}
// END - Users viewing this thread 

ps: I like this php code Big Grin, can I use it on my board too?
To translate this mod yourself you'll need to edit the following templates:
  • showthread_usersviewing_user
  • showthread_usersviewing_guest
  • showthread_usersviewing
Unfortunately, I can't provide a dutch translation myself as I only speak English.

Language support might be added to my mods when they recieve a major overhaul once MyBB Gold is out of the door. I haven't quite made up my mind yet.

The PHP tags still have lots of bugs that need fixing so I'm probably not going to release this feature as a mod, or at least not for a while.
Reference URL's