Mx_chatbox_online problem
 
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.   printer-friendly view    phpMiX.org Forum Index -> mxBB Modules -> mxBB Module: mx_chatbox
View previous topic :: View next topic  
Author Message
siljo11
Starter
Starter


Joined: 05 Mar 2006
Posts: 2

PostPosted: Sun Mar 05, 2006 3:02 pm    Post subject: Mx_chatbox_online problem Reply with quote

Hello!
On my phpbb2 forum i installed this mod!
Code:
##############################################################
## MOD Title:      Extend rank color
## MOD Author:      Gendo < gendo@denturax.com > (Matthieu V.) http://www.denturax.com
## MOD Author:      BigZ  < bigz@denturax.com > (Romain R.) http://www.denturax.com
## MOD Description:
##         This mod gives the possibility to add colour ranks into "Who is online"
##         page and into "Who is online" part in bottom of the index. You can
##         create colour ranks via the ACP. You can also put in colour your various
##         groups of users (phpBB Usergroups) on the index and the sight of
##         viewonline.
##
## MOD Version:      2.0.0
## Compatibility:       2.0.6-2.0.13
##
## Installation Level:   easy
## Installation Time:   30 Minutes
## Files To Edit: (10)
##          viewonline.php
##          admin/admin_users.php
##          admin/admin_groups.php
##         admin/admin_board.php
##          includes/constants.php
##          includes/page_header.php
##          templates/subSilver/index_body.tpl 
##          templates/subSilver/admin/user_edit_body.tpl    
##          templates/subSilver/admin/group_edit_body.tpl   
##          templates/subSilver/admin/board_config_body.tpl
##
## Included Files: (4)
##          admin/admin_ranks_whosonline.php
##          templates/subSilver/admin/whosonline_ranks_edit_body.tpl
##          templates/subSilver/admin/whosonline_ranks_list_body.tpl
##         language/lang_english/lang_erc.php
##          
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ SQL ]------------------------------------------
#
CREATE TABLE `phpbb_whosonline_ranks` (
  `whosonline_rank_id` tinyint(4) NOT NULL auto_increment,
  `whosonline_rank_name` varchar(50) NOT NULL default '',
  `whosonline_rank_color` varchar(9) NOT NULL default '',
  `whosonline_lang_key` smallint(1) unsigned NOT NULL default '0',
  `whosonline_rank_order` int(11) NOT NULL default '0',
  PRIMARY KEY  (`whosonline_rank_id`)
) TYPE=MyISAM AUTO_INCREMENT=20 ;

#
#-----[ SQL ]------------------------------------------
#
INSERT INTO `phpbb_whosonline_ranks` VALUES (1, 'Test', 'red', 0, 10);

#
#-----[ SQL ]------------------------------------------
#

ALTER TABLE phpbb_users ADD user_whosonline_color int(11) DEFAULT '0' NOT NULL;

#
#-----[ SQL ]------------------------------------------
#

ALTER TABLE `phpbb_groups` ADD `group_color` smallint(8) DEFAULT '0' NOT NULL ;

#
#-----[ SQL ]------------------------------------------
#

INSERT INTO `phpbb_config` VALUES ('allow_group_index', '0');

#
#-----[ COPY ]------------------------------------------------
#
copy root/language/lang_english/lang_erc.php to language/lang_english/lang_erc.php
copy root/admin/admin_ranks_whosonline.php to admin/admin_ranks_whosonline.php
copy root/templates/subSilver/admin/whosonline_ranks_edit_body.tpl to templates/subSilver/admin/whosonline_ranks_edit_body.tpl
copy root/templates/subSilver/admin/whosonline_ranks_list_body.tpl to templates/subSilver/admin/whosonline_ranks_list_body.tpl

#
#-----[ OPEN ]-----
#
viewonline.php

#
#-----[ FIND ]-----
#
//
// Get auth data
//
$is_auth_ary = array();
$is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata);

#
#-----[ AFTER, ADD ]------------------------------------------
#

   $ranks_sql= " SELECT * from " . WHOSONLINE_RANKS_TABLE . " ORDER BY whosonline_rank_order";

      if ( !($ranks_result = $db->sql_query($ranks_sql)) )
      {
         message_die(GENERAL_MESSAGE, 'Fatal Error into getting whos is online color');
      }

      while( $rank_row = $db->sql_fetchrow($ranks_result) )
      {

         $id_color[ $rank_row['whosonline_rank_id'] ] = $rank_row['whosonline_rank_color'];
      }

   if ( $board_config['allow_group_index'] )
   {

      $group_user_sql= "SELECT ug.group_id, ug.user_id, g.group_color from " . USER_GROUP_TABLE . " ug," . GROUPS_TABLE . " g, " . WHOSONLINE_RANKS_TABLE . " wr
         WHERE  ug.group_id=g.group_id
            AND g.group_color <> '0'
            AND ug.user_pending <> '1'
            AND wr.whosonline_rank_id = g.group_color
         ORDER BY wr.whosonline_rank_order DESC";
         if ( !($group_user_result = $db->sql_query($group_user_sql)) )
         {
            message_die(GENERAL_MESSAGE, 'Fatal Error into getting user in group');
         }

         while( $group_user_row = $db->sql_fetchrow($group_user_result) )
         {
            $user_group_color[ $group_user_row['user_id'] ] = $id_color[ $group_user_row['group_color'] ];
         }
   }

#
#-----[ FIND ]-----
#
$sql = "SELECT u.user_id, u.username, u.user_allow_viewonline, u.user_level, s.session_logged_in, s.session_time, s.session_page, s.session_ip

#
#-----[ IN-LINE FIND ]------------------------------------------
#
, u.user_level

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, u.user_whosonline_color

#
#-----[ FIND ]-----
#
         if ( $row['user_level'] == ADMIN )
         {
            $username = '<b style="color:#' . $theme['fontcolor3'] . '">' . $username . '</b>';
         }
#
#-----[ REPLACE WITH ]------------------------------------------
#
         if ( $row['user_whosonline_color'] )
         {
            $username = '<b style="color:' . $id_color[$row[user_whosonline_color]] . '">' . $username . '</b>';
         }
         else if ( $row['user_level'] == ADMIN )
         {
            $username = '<b style="color:#' . $theme['fontcolor3'] . '">' . $username . '</b>';
         }

#
#-----[ FIND ]-----
#
         else if ( $row['user_level'] == MOD )
         {
            $username = '<b style="color:#' . $theme['fontcolor2'] . '">' . $username . '</b>';
         }

#
#-----[ AFTER, ADD ]------------------------------------------
#
         else if ( $user_group_color[$row['user_id']])
         {
            $username = '<b style="color:' . $user_group_color[ $row['user_id'] ] . '">' . $username . '</b>';
         }

#
#-----[ OPEN ]-----
#
admin/admin_users.php

#
#-----[ FIND ]------------------------------------------
#
require('./pagestart.' . $phpEx);

#
#-----[ AFTER, ADD ]------------------------------------------
#
include($phpbb_root_path . 'language/lang_' . $userdata['user_lang'] .    '/lang_erc.' .    $phpEx);

#
#-----[ FIND ]------------------------------------------------
#
      $user_allowavatar = ( !empty($HTTP_POST_VARS['user_allowavatar']) ) ? intval( $HTTP_POST_VARS['user_allowavatar'] ) : 0;

#
#-----[ AFTER, ADD ]------------------------------------------
#
      $whosonline_rank = $HTTP_POST_VARS['whosonline_rank'];

#
#-----[ FIND ]------------------------------------------------
#
# this is a partial search : the full line is longer
#
SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace

#
#-----[ IN-LINE FIND ]------------------------------------------
#
user_interests = '" . str_replace("\'", "''", $interests) . "'


#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, user_whosonline_color='$whosonline_rank'

#
#-----[ FIND ]------------------------------------------
#
      //
      // Let's do an overall check for settings/versions which would prevent
      // us from doing file uploads....
      //

#
#-----[ BEFORE, ADD ]-----
#
      $sql = "SELECT * FROM " . WHOSONLINE_RANKS_TABLE . "";
      
      if(!$result = $db->sql_query($sql))
         {
            message_die(GENERAL_ERROR, "Couldn't obtain who's online ranks data", "", __LINE__, __FILE__, $sql);
         }

      $rank_rows = $db->sql_fetchrowset($result);
      $rank_count = count($rank_rows);
      $whosonlinecolor .= '<select name="whosonline_rank" class="gensmall"><option value="">Aucun</option>';

      for( $i = 0; $i < $rank_count; $i++)
      {
         $rank = $rank_rows[$i]['whosonline_rank_name'];
         $rank_color = $rank_rows[$i]['whosonline_rank_color'];
         $rank_id = $rank_rows[$i]['whosonline_rank_id'];
         if ($this_userdata['user_whosonline_color'] == "$rank_id")
         {
            $checked = "SELECTED";
         }
         else
         {
            $checked = '';
         }
         $whosonlinecolor .= '<option value="' . $rank_id . '" style="color:' . $rank_color . '" ' . $checked . '>' . $rank . '';
      }

#
#-----[ FIND ]------------------------------------------
#
         'RANK_SELECT_BOX' => $rank_select_box,

#
#-----[ AFTER, ADD ]------------------------------------------
#
         'WHOSONLINE_RANK' => $whosonlinecolor,

#
#-----[ FIND ]------------------------------------------
#
         'L_LINK_REMOTE_AVATAR' => $lang['Link_remote_Avatar'],

#
#-----[ AFTER, ADD ]------------------------------------------
#
         'L_WHOSONLINE_RANK' => $lang['whosonline_ranks_title'],

#
#-----[ OPEN ]-----
#
admin/admin_groups.php

#
#-----[ FIND ]------------------------------------------
#
require('./pagestart.' . $phpEx);

#
#-----[ AFTER, ADD ]------------------------------------------
#
include($phpbb_root_path . 'language/lang_' . $userdata['user_lang'] .    '/lang_erc.' .    $phpEx);

#
#-----[ FIND ]------------------------------------------
#
   //
   // Ok, now we know everything about them, let's show the page.
   //

#
#-----[ BEFORE, ADD ]------------------------------------------
#
   $sql = "SELECT * FROM " . WHOSONLINE_RANKS_TABLE . "";
      if(!$result = $db->sql_query($sql))
      {
         message_die(GENERAL_ERROR, "Couldn't obtain who's online ranks data", "", __LINE__, __FILE__, $sql);
      }
   $rank_rows = $db->sql_fetchrowset($result);
   $rank_count = count($rank_rows);
   $template->assign_block_vars('whosonline_rank', array(
         'VALUE' => "0",
         'SELECT' => "",
         'NAME' => $lang['None']));
   for( $i = 0; $i < $rank_count; $i++)
   {
      $rank = $rank_rows[$i]['whosonline_rank_name'];
      $rank_color = $rank_rows[$i]['whosonline_rank_color'];
      $rank_id = $rank_rows[$i]['whosonline_rank_id'];
      if ($group_info['group_color'] == "$rank_id")
      {
         $checked = "SELECTED";
      }
      else
      {
         $checked = '';
      }
      $template->assign_block_vars('whosonline_rank', array(
         'VALUE' => $rank_id,
         'SELECT' => $checked,
         'STYLE' => $rank_color,
         'NAME' => $rank));
   }

#
#-----[ FIND ]------------------------------------------
#
      'L_YES' => $lang['Yes'],

#
#-----[ AFTER, ADD ]------------------------------------------
#
      'L_RANK_COLOR' => $lang['color'],
      'L_COLOR_DARK_RED' => $lang['color_dark_red'],
      'L_COLOR_RED' => $lang['color_red'],
      'L_COLOR_ORANGE' => $lang['color_orange'],
      'L_COLOR_BROWN' => $lang['color_brown'],
      'L_COLOR_YELLOW' => $lang['color_yellow'],
      'L_COLOR_GREEN' => $lang['color_green'],
      'L_COLOR_OLIVE' => $lang['color_olive'],
      'L_COLOR_CYAN' => $lang['color_cyan'],
      'L_COLOR_BLUE' => $lang['color_blue'],
      'L_COLOR_DARK_BLUE' => $lang['color_dark_blue'],
      'L_COLOR_INDIGO' => $lang['color_indigo'],
      'L_COLOR_VIOLET' => $lang['color_violet'],
      'L_COLOR_WHITE' => $lang['color_white'],
      'L_COLOR_BLACK' => $lang['color_black'],

#
#-----[ FIND ]------------------------------------------
#
      $delete_old_moderator = isset($HTTP_POST_VARS['delete_old_moderator']) ? true : false;

#
#-----[ AFTER, ADD ]------------------------------------------
#
      $group_color = $HTTP_POST_VARS['whosonline_rank'];

#
#-----[ FIND ]------------------------------------------------
#
# this is a partial search : the full line is longer
#
SET group_type = $group_type, group_name

#
#-----[ IN-LINE FIND ]------------------------------------------
#
group_moderator = $group_moderator

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, group_color = '$group_color'

#-----[ FIND ]------------------------------------------------
#
# this is a partial search : the full line is longer
#
$sql = "INSERT INTO " . GROUPS_TABLE . "

#
#-----[ IN-LINE FIND ]------------------------------------------
#
group_single_user

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, group_color

#
#-----[ FIND ]------------------------------------------
#
VALUES ($group_type, '" . str_replace("\'", "''", $group_name) . "', '" . str_replace("\'", "''", $group_description) . "', $group_moderator,   '0')";

#
#-----[ IN-LINE FIND ]------------------------------------------
#
'0'

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, '$group_color'

#
#-----[ OPEN ]-----
#
admin/admin_board.php

#
#-----[ FIND ]------------------------------------------
#
require('./pagestart.' . $phpEx);

#
#-----[ AFTER, ADD ]------------------------------------------
#
include($phpbb_root_path . 'language/lang_' . $userdata['user_lang'] .    '/lang_erc.' .    $phpEx);

#
#-----[ FIND ]-----
#
$namechange_yes = ( $new['allow_namechange'] ) ? "checked=\"checked\"" : "";
$namechange_no = ( !$new['allow_namechange'] ) ? "checked=\"checked\"" : "";

#
#-----[ AFTER, ADD ]-----
#

$allow_group_index_yes = ( $new['allow_group_index'] ) ? "checked=\"checked\"" : "";
$allow_group_index_no = ( !$new['allow_group_index'] ) ? "checked=\"checked\"" : "";

#
#-----[ FIND ]-----
#
   "L_MAX_SIG_LENGTH_EXPLAIN" => $lang['Max_sig_length_explain'],
   "L_ALLOW_NAME_CHANGE" => $lang['Allow_name_change'],

#
#-----[ AFTER, ADD ]-----
#
   "L_ALLOW_GROUP_INDEX" => $lang['groups_index'],

#
#-----[ FIND ]-----
#
   "NAMECHANGE_YES" => $namechange_yes,
   "NAMECHANGE_NO" => $namechange_no,

#
#-----[ AFTER, ADD ]-----
#
   "ALLOW_GROUP_INDEX_YES" => $allow_group_index_yes,
   "ALLOW_GROUP_INDEX_NO" => $allow_group_index_no,

#
#-----[ OPEN ]-----
#
includes/constants.php

#
#-----[ FIND ]-----
#
?>

#
#-----[ BEFORE, ADD ]-----
#
define('WHOSONLINE_RANKS_TABLE', $table_prefix.'whosonline_ranks');

#
#-----[ OPEN ]-----
#
includes/page_header.php

#
#-----[ FIND ]-----
#
if (defined('SHOW_ONLINE'))
{

#
#-----[ AFTER, ADD ]-----
#

   $ranks_sql= " SELECT * from " . WHOSONLINE_RANKS_TABLE . " ORDER BY whosonline_rank_order";
      if ( !($ranks_result = $db->sql_query($ranks_sql)) )
      {
         message_die(GENERAL_MESSAGE, 'Fatal Error into getting whos is online color');
      }

   while( $rank_row = $db->sql_fetchrow($ranks_result) )
   {
      if ($rank_row['whosonline_lang_key'] && isset($lang[ $rank_row['whosonline_rank_name'] ]))   
      $rank_name = $lang[ $rank_row['whosonline_rank_name'] ];
      else
      $rank_name = $rank_row['whosonline_rank_name'];

      $whosonline_color .= "[ <span style=\"color:". $rank_row['whosonline_rank_color'] ."\"><b>". $rank_name . "</b></span> ]&nbsp;&nbsp;";
      $id_color[ $rank_row['whosonline_rank_id'] ] = $rank_row['whosonline_rank_color'];
   }

   if ( $board_config['allow_group_index'] )
   {

   $group_user_sql= "SELECT ug.group_id, ug.user_id, g.group_color from " . USER_GROUP_TABLE . " ug," . GROUPS_TABLE . " g, " . WHOSONLINE_RANKS_TABLE . " wr
      WHERE  ug.group_id=g.group_id
         AND g.group_color <> '0'
         AND ug.user_pending <> '1'
         AND wr.whosonline_rank_id = g.group_color
      ORDER BY wr.whosonline_rank_order DESC";

      if ( !($group_user_result = $db->sql_query($group_user_sql)) )
      {
         message_die(GENERAL_MESSAGE, 'Fatal Error into getting user in group');
      }

   while( $group_user_row = $db->sql_fetchrow($group_user_result) )
     {
       $user_group_color[ $group_user_row['user_id'] ] = $id_color[ $group_user_row['group_color'] ];
      }
   }
             $template->assign_vars(array(
             'WHOSONLINE_LEGEND' => "$whosonline_color")
         );

#
#-----[ FIND ]-----
#
$sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, u.user_level, s.session_logged_in, s.session_ip

#
#-----[ IN-LINE FIND ]------------------------------------------
#
, u.user_level

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, u.user_whosonline_color

#
#-----[ FIND ]-----
#
            if ( $row['user_level'] == ADMIN )
            {
               $row['username'] = '<b>' . $row['username'] . '</b>';
               $style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
            }

#
#-----[ REPLACE WITH ]------------------------------------------
#
            if ( $row['user_whosonline_color'] )
            {
               $row['username'] = '<b>' . $row['username'] . '</b>';
               $style_color .= 'style="color:' . $id_color[$row[user_whosonline_color]] . '"';
            }

            else if ( $row['user_level'] == ADMIN )
            {
               $row['username'] = '<b>' . $row['username'] . '</b>';
               $style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
            }

#
#-----[ FIND ]-----
#
            else if ( $row['user_level'] == MOD )
            {
               $row['username'] = '<b>' . $row['username'] . '</b>';
               $style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
            }

#
#-----[ AFTER, ADD ]------------------------------------------
#
            else if ( $user_group_color[$row['user_id']] )
            {
               $row['username'] = '<b>' . $row['username'] . '</b>';
               $style_color .= 'style="color:' . $user_group_color[$row['user_id']] . '"';
            }

#
#-----[ OPEN ]-----
#
templates/subSilver/index_body.tpl 

#
#-----[ FIND ]-----
#
   <td class="row1" align="left"><span class="gensmall">{TOTAL_USERS_ONLINE} &nbsp; [ {L_WHOSONLINE_ADMIN} ] &nbsp; [ {L_WHOSONLINE_MOD} ]<br />{RECORD_USERS}<br />{LOGGED_IN_USER_LIST}</span></td>

#
#-----[ REPLACE WITH ]------------------------------------------
#
   <td class="row1" align="left"><span class="gensmall">{TOTAL_USERS_ONLINE}<br />
 &nbsp; [ {L_WHOSONLINE_ADMIN} ] &nbsp; [ {L_WHOSONLINE_MOD} ] &nbsp;{WHOSONLINE_LEGEND}<br />
{RECORD_USERS}<br />{LOGGED_IN_USER_LIST}</span></td>

#
#-----[ OPEN ]-----
#
templates/subSilver/admin/user_edit_body.tpl

#
#-----[ FIND ]-----
#
   <tr>
      <td class="row1"><span class="gen">{L_SELECT_RANK}</span></td>
      <td class="row2"><select name="user_rank">{RANK_SELECT_BOX}</select></td>
   </tr>

#
#-----[ AFTER, ADD ]------------------------------------------
#
   <tr>
     <td class="row1"><span class="gen">{L_WHOSONLINE_RANK}</span></td>
     <td class="row2">{WHOSONLINE_RANK}</td>
   </tr>

#
#-----[ OPEN ]-----
#
templates/subSilver/admin/group_edit_body.tpl

#
#-----[ FIND ]-----
#
   <tr>
     <td class="row1" width="38%"><span class="gen">{L_GROUP_NAME}:</span></td>
     <td class="row2" width="62%">
      <input class="post" type="text" name="group_name" size="35" maxlength="40" value="{GROUP_NAME}" />
     </td>
   </tr>

#
#-----[ AFTER, ADD ]------------------------------------------
#
   <tr>
      <td class="row1" width="38%"><span class="gen">{L_RANK_COLOR}:</span></td>
      <td class="row2">
         <select name="whosonline_rank" class="gensmall">
         <!-- BEGIN whosonline_rank -->
         <option {whosonline_rank.SELECT} value="{whosonline_rank.VALUE}" style="color:{whosonline_rank.STYLE}" >{whosonline_rank.NAME}</option>
         <!-- END whosonline_rank -->
         </select>
      </td>
   </tr>

#
#-----[ OPEN ]-----
#
templates/subSilver/admin/board_config_body.tpl

#
#-----[ FIND ]-----
#
      <td class="row2"><input type="radio" name="prune_enable" value="1" {PRUNE_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="prune_enable" value="0" {PRUNE_NO} /> {L_NO}</td>
   </tr>

#
#-----[ AFTER, ADD ]------------------------------------------
#
   <tr>
      <td class="row1">{L_ALLOW_GROUP_INDEX}</span></td>
      <td class="row2"><input type="radio" name="allow_group_index" value="1" {ALLOW_GROUP_INDEX_YES} /> {L_ENABLED}&nbsp;&nbsp;<input type="radio" name="allow_group_index" value="0" {ALLOW_GROUP_INDEX_NO} /> {L_DISABLED}</td>
   </tr>

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM


And now i have nice mod colors for my users!
But in my mx-chatbox online i dont have this colors!
I tried to modid my self,but i`m no php expert so i failed!
Can somebody please help me?

Sorry for my bad english!
 
Back to top
View user's profile Send private message
siljo11
Starter
Starter


Joined: 05 Mar 2006
Posts: 2

PostPosted: Tue Mar 07, 2006 11:00 pm    Post subject: re Reply with quote

Anbody?

Markus!Please help me!
 
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.   printer-friendly view    phpMiX.org Forum Index -> mxBB Modules -> mxBB Module: mx_chatbox All times are GMT + 1 Hour
 
Page 1 of 1


 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum