1
AsakuraStar
Newbb More Who's online groups
  • 2006/2/6 22:27

  • AsakuraStar

  • Just popping in

  • Posts: 8

  • Since: 2005/12/2


Hello again.

As you guys know, the newbb forum module has in "who's online" 2 groups like this:

Users Online:1 Users browsing forum

[ Administrator ] and [ Moderator ]

--------------------------------------------------

I want have more groups with another colors showing for example:

[ Administrator ] [ Moderator ] [ Helper ] [ Colaborator ]

And of course with all nicks in the groups listed with the same color of each group.

Is there a way to do this?
Sorry for my bad english, i'm actualy brazilian.

Thank you.

2
AsakuraStar
Re: Newbb More Who's online groups
  • 2006/2/7 21:25

  • AsakuraStar

  • Just popping in

  • Posts: 8

  • Since: 2005/12/2


Anyone?

3
iHackCode
Re: Newbb More Who's online groups

i can probably do this. but i need some help

online.php has this line
if(newbb_isAdministrator($users[$i]['online_uid'])){
                
$online['users'][$i]['color']= $xoopsModuleConfig['wol_admin_col'];
            }


and function.php has these functions.
function &getModuleAdministrators($mid=0)
{
    static 
$module_administrators=array();
    if(isset(
$module_administrators[$mid])) return $module_administrators[$mid];

    
$moduleperm_handler =& xoops_gethandler('groupperm');
    
$groupsIds $moduleperm_handler->getGroupIds('module_admin'$mid);

    
$administrators = array();
    
$member_handler =& xoops_gethandler('member');
    foreach(
$groupsIds as $groupid){
        
$userIds $member_handler->getUsersByGroup($groupid);
        foreach(
$userIds as $userid){
            
$administrators[$userid] = 1;
        }
    }
    
$module_administrators[$mid] =array_keys($administrators);
    unset(
$administrators);
    return 
$module_administrators[$mid];
}

function 
newbb_isAdministrator($user=-1$mid=0)
{
    global 
$xoopsUser;
    static 
$administrators$xoopsModule$newBB_mid;

    if(
$user == -1$user = &$xoopsUser;
    if(!
is_object($user) && intval($user)<1) return false;
    
$uid = (is_object($user))?$user->getVar('uid'):intval($user);

    if(!
$mid){
        if (!isset(
$newBB_mid)) {
            if(
is_object($xoopsModule)&& 'newbb' == $xoopsModule->dirname()){
                
$newBB_mid $xoopsModule->getVar('mid');
            }else{
                
$modhandler = &xoops_gethandler('module');
                
$newBB = &$modhandler->getByDirname('newbb');
                
$newBB_mid $newBB->getVar('mid');
                unset(
$newBB);
            }
        }
        
$mid $newBB_mid;
    }

    if(!isset(
$administrators)) {
        
$administrators =& getModuleAdministrators($mid);
    }

    return 
in_array($uid,$administrators);
}


but how do i make a new function that does the same thing but for a specific group.
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

4
AsakuraStar
Re: Newbb More Whos online groups
  • 2006/2/9 14:23

  • AsakuraStar

  • Just popping in

  • Posts: 8

  • Since: 2005/12/2


Good question, i wish can help you

5
AsakuraStar
Re: Newbb More Whos online groups
  • 2006/2/11 16:00

  • AsakuraStar

  • Just popping in

  • Posts: 8

  • Since: 2005/12/2


...

6
iHackCode
Re: Newbb More Whos online groups

which forum module are you using and what version?

i have the code for adding an option to the admin menu for the module and the template. but the only thing i dont know how to do is the function.
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

7
AsakuraStar
Re: Newbb More Whos online groups
  • 2006/2/13 15:50

  • AsakuraStar

  • Just popping in

  • Posts: 8

  • Since: 2005/12/2


NewBB 2 v2.02

8
iHackCode
Re: Newbb More Whos online groups

Quote:

AsakuraStar wrote:
NewBB 2 v2.02

thought so, just wanted to make sure.

this is not complete but this is what i got so far
things in red is what i added and things in green are what needs to be finished still

xoops_version.php
$modversion['config'][] = array(
    
'name' => 'wol_mod_col',
    
'title' => '_MI_WOL_MOD_COL',
    
'description' => '_MI_WOL_MOD_COL_DESC',
    
'formtype' => 'textbox',
    
'valuetype' => 'text',
    
'default' => '#006600');
[
color=CC0000
$modversion['config'][] = array(
    
'name' => 'wol_thirdgroup_col',
    
'title' => '_MI_WOL_THIRDGROUP_COL',
    
'description' => '_MI_WOL_THIRDGROUP_COL_DESC',
    
'formtype' => 'textbox',
    
'valuetype' => 'text',
    
'default' => '#CC0000');
    
$modversion['config'][] = array(
    
'name' => 'wol_fourthgroup_col',
    
'title' => '_MI_WOL_FOURTHGROUP_COL',
    
'description' => '_MI_WOL_FOURTHGROUP_COL_DESC',
    
'formtype' => 'textbox',
    
'valuetype' => 'text',
    
'default' => '#0099FF');[/color]


language/english/main.php
[color=CC0000]define('_MD_THIRDGROUP','ThirdGroup');
define('_MD_FOURTHGROUP','FourthGroup');[/color]


language/english/modinfo.php
[color=CC0000]define("_MI_WOL_THIRDGROUP_COL","ThirdGroup Highlight Color");
define("_MI_WOL_THIRDGROUP_COL_DESC","Highlight Color of the ThirdGroup Shown in the ...");
define("_MI_WOL_FOURTHGROUP_COL","FourthGroup Highlight Color");
define("_MI_WOL_FOURTHGROUP_COL_DESC","Highlight Color of the FourthGroup Shown in the...");[/color]


index.php
if ($xoopsModuleConfig['wol_enabled']){
    
$online_handler =& xoops_getmodulehandler('online''newbb');
    
$online_handler->init();
    
$xoopsTpl->assign('online'$online_handler->show_online());
    
$xoopsTpl->assign('color_admin'$xoopsModuleConfig['wol_admin_col']);
    
$xoopsTpl->assign('color_mod'$xoopsModuleConfig['wol_mod_col']);
    [
color=CC0000]$xoopsTpl->assign('color_thirdgroup'$xoopsModuleConfig['wol_thirdgroup_col']);
    
$xoopsTpl->assign('color_fourthgroup'$xoopsModuleConfig['wol_fourthgroup_col']); [/color]
}


viewforum.php
if ($xoopsModuleConfig['wol_enabled']){
    
$online_handler =& xoops_getmodulehandler('online''newbb');
    
$online_handler->init($forum);
    
$xoopsTpl->assign('online'$online_handler->show_online());
    
$xoopsTpl->assign('color_admin'$xoopsModuleConfig['wol_admin_col']);
    
$xoopsTpl->assign('color_mod'$xoopsModuleConfig['wol_mod_col']);
    [
color=CC0000]$xoopsTpl->assign('color_thirdgroup'$xoopsModuleConfig['wol_thirdgroup_col']);
    
$xoopsTpl->assign('color_fourthgroup'$xoopsModuleConfig['wol_fourthgroup_col']);
 [/
color]
}


viewtopic.php
if ($xoopsModuleConfig['wol_enabled']){
    
$online_handler =& xoops_getmodulehandler('online''newbb');
    
$online_handler->init($viewtopic_forum$forumtopic);
    
$xoopsTpl->assign('online'$online_handler->show_online());
    
$xoopsTpl->assign('color_admin'$xoopsModuleConfig['wol_admin_col']);
    
$xoopsTpl->assign('color_mod'$xoopsModuleConfig['wol_mod_col']);
    [
color=CC0000]$xoopsTpl->assign('color_thirdgroup'$xoopsModuleConfig['wol_thirdgroup_col']);
    
$xoopsTpl->assign('color_fourthgroup'$xoopsModuleConfig['wol_fourthgroup_col']); [/color]
}


templates/newbb_online.html
[ <span style="color:<{$color_admin}>"><{$smarty.const._MD_ADMINISTRATOR}>span> ] [ <span  style="color:<{$color_mod}>"><{$smarty.const._MD_MODERATOR}>span> ][color=CC0000][ <span style="color:<{$color_thirdgroup}>"><{$smarty.const._MD_THIRDGROUP}>span> ] [ <span  style="color:<{$color_fourthgroup}>"><{$smarty.const._MD_FOURTHGROUP}>span> ] [/color]


class/online.php (unfinished)
function &show_online()
    {
        global 
$xoopsModuleConfig$forumImage;

        if (
$this->forumtopic)
            
$num_total $this->getCount(new Criteria('online_topic'$this->forumtopic));
        elseif (
$this->forum)
            
$num_total $this->getCount(new Criteria('online_forum'$this->forum));
        else
            
$num_total $this->getCount();

        if (
$this->forumtopic) {
            
$criteria = new CriteriaCompo(new Criteria('online_topic'$this->forumtopic));
            
$criteria->add(new Criteria('online_uid''0''<>'));
        } elseif (
$this->forum) {
            
$criteria = new CriteriaCompo(new Criteria('online_forum'$this->forum));
            
$criteria->add(new Criteria('online_uid''0''<>'));
        } else {
            
$criteria = new Criteria('online_uid''0''<>');
        }
        
$users = &$this->getAll($criteria);
        
$num_user count($users);
        
$num_anonymous $num_total $num_user;

        
$online = array();
        
$online['image'] = newbb_displayImage($forumImage['whosonline']);
        
$online['num_total'] = $num_total;
        
$online['num_user'] = $num_user;
        
$online['num_anonymous'] = $num_anonymous;

        for (
$i 0$i $num_user$i++) {
            
$online['users'][$i]['link']= XOOPS_URL "/userinfo.php?uid=" $users[$i]['online_uid'];
            
$online['users'][$i]['uname']= $users[$i]['online_uname'];
            if(
newbb_isAdministrator($users[$i]['online_uid'])){
                
$online['users'][$i]['color']= $xoopsModuleConfig['wol_admin_col'];
            }
            elseif(
newbb_isModerator($this->forum_object$users[$i]['online_uid'])){
                
$online['users'][$i]['color']= $xoopsModuleConfig['wol_mod_col'];
            }
            [
color=009900/*
            elseif(some function for the third group){
                $online['users'][$i]['color']= $xoopsModuleConfig['wol_thirdgroup_col'];
            }
            elseif(some function for the 4th group){
                $online['users'][$i]['color']= $xoopsModuleConfig['wol_fourthgroup_col'];
            }
*/
[/color]
           else{
                
$online['users'][$i]['color']= "";
            }
        }

        return 
$online;
    }
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

9
Mantooth
Re: Newbb More Whos online groups
  • 2006/2/13 20:36

  • Mantooth

  • Friend of XOOPS

  • Posts: 189

  • Since: 2004/11/2


when you're done, you should let phppp know about it and he can add it as a new feature on the next release.
...


I hate Mortal Kombat

10
AsakuraStar
Re: Newbb More Whos online groups
  • 2006/2/13 21:53

  • AsakuraStar

  • Just popping in

  • Posts: 8

  • Since: 2005/12/2


If you need help to test your codes, let me know when it gets ready.

Login

Who's Online

337 user(s) are online (281 user(s) are browsing Support Forums)


Members: 0


Guests: 337


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits