Log in Register FAQ Memberlist Search Welcome to RCF - WHF Forum Index
alt : test.swf
Welcome to RCF - WHF
4fx3.gif 
calendar_open_closeCalendar 
[Solved] Simple Colour Usergroups
Post new topic   Reply to topic View previous topic :: View next topic
Goto page: 1, 2, 3  Next
Welcome to RCF - WHF Forum Index -> Area 51 - phpBB & Easymod Tech Support Add To Bookmarks
[Solved] Simple Colour Usergroups
PostPosted: 06/21/2007 4:09 AM Reply with quote
Citation
Karen
Citation
Posts 1253
Word Cnt. 68,166
BDay Nov 9
Sign Scorpio
Sex Sex:Female
Joined: Jan 06, 2006
Local time: 10:30 PM
greatbrE.gif
I installed with Easymod but did a couple of instructions myself.

In the group management bit I have two boxes for selecting colours  dontknow  I went back to check the code changes but can't find anything doubled, but also while I was there I went to check the code change for templates/subsilver/index_body.tpl and although EM said its done that I can't find the code that should've been added  dontknow

Code:
##############################################################
## MOD Title: Simple Colored Usergroups
## MOD Author: kkroo < > (Omar Ramadan) http://phpbb-login.sourceforge.net
## MOD Author: Afterlife_69 < > (Dean Newman) http://www.ugboards.com
## MOD Description: Replaces the current username coloring with a group based system like in Olympus (phpBB3).
## MOD Version: 1.0.1
##
## Installation Level: Easy
## Installation Time: 5 minutes
## Files To Edit: index.php
##                viewonline.php
##                common.php
##                groupcp.php
##                includes/functions.php
##                includes/page_header.php
##                admin/admin_groups.php
##                admin/admin_users.php
##                templates/subSilver/admin/group_edit_body.tpl
##                templates/subSilver/admin/user_edit_body.tpl
##                templates/subSilver/index_body.tpl
##                language/lang_english/lang_main.php
##                language/lang_english/lang_admin.php
##                includes/usercp_register.php
##                templates/subSilver/profile_add_body.tpl
## Included Files:
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
##   Author Notes:
##      Better than the others :)
##   ----------------------------------------------------------
##   MOD Features
##   ----------------------------------------------------------
##   * Different sets of colors for each template.
##   * Automaticly use first color found for template if template color unset.
##   * 1 MySQL Query per page added.
##   * User Indepentant Group Priorities.
##   * Group coloring optional, Not applied to all groups.
##   * Ability to change the order of groups on the legend.
##   * Ability to control users Group Priorities.
##   * Show and group group and members for admin/mod if group is hidden.
##
##############################################################
## MOD History:
##
##   2006-04-10 - Version 0.1.0
##      -   Alpha version created.
##
##   2006-04-10 - Version 0.2.0
##      -   Project now is Stable BETA testing stage.
##
##   2006-04-11 - Version 0.3.0
##      -   Fixed a bug in the editprofile page that showed all color group instead of the ones the user was a member of.
##      -   Fixed a bug in the editprofile page that allowed a member to exploit the system and obtain the color of a group they are not a member of via posting a form from another page.
##
##   2006-04-11 - Version 0.4.0
##      -   Added a feature to allow the admin to edit the user's priority group via the ACP.
##
##   2006-06-10 - Version 0.5.0
##      -   Fixed the error message on registration.
##
##   2006-06-10 - Version 1.0.0
##      -   Ready for the MODS DB :).
##
##   2006-06-10 - Version 1.0.1
##      -   Fixed bug in admin_users.php.
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ SQL ]------------------------------------------
#
# Note:   If you prefer you can run the db_update.php file in /contrib
#      however you must run this file before making code changes.
#
ALTER TABLE phpbb_groups ADD group_colored tinyint(1) NOT NULL;
ALTER TABLE phpbb_groups ADD group_colors TEXT NOT NULL;
ALTER TABLE phpbb_groups ADD group_order int(255) NOT NULL;
ALTER TABLE phpbb_users ADD group_priority int(255) NOT NULL;

#
#-----[ OPEN ]------------------------------------------
#
index.php

#
#-----[ FIND ]------------------------------------------
#
   $template->set_filenames(array(
      'body' => 'index_body.tpl')
   );

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

   // SIMPLE COLORED USERGROUPS MOD START
   if ( is_array($color_groups['groupdata']) )
   {
      $group_legend = array();
      foreach($color_groups['groupdata'] AS $group_id => $group_data)
      {
         if ( ! $userdata['session_logged_in'] )
         {
            $group_color = $group_data['group_color'][ $board_config['default_style'] ];
         }
         else
         {
            $group_color = $group_data['group_color'][ $userdata['user_style'] ];
         }
         if ( ! $group_color )
         {
            $match_found = false;
            foreach ( $group_data['group_color'] AS $color )
            {
               if ( ! $match_found )
               {
                  if ( $color )
                  {
                     $group_color = $color;
                     $match_found = true;
                  }
               }
            }
         }
         if ( $group_color )
         {
            $grouplink = '<a class="gensmall" style="font-weight: bold; color: #' . $group_color . '" href="' . append_sid("groupcp.$phpEx?g=" . $group_data['group_id']) . '">' . $group_data['group_name'] . '</a>';
            $group_legend[] = $grouplink;
         }
      }
      $group_legend = implode(', ', $group_legend);
   }
   if ( ! $group_legend )
   {
      $group_legend = $lang['No_groups_exist'];
   }
   $group_legend = $lang['color_groups_legend'] . ': ' . $group_legend;
   // COLOR GROUPS END

#
#-----[ FIND ]------------------------------------------
#
'FORUM_LOCKED_IMG' => $images['forum_locked'],

#
#-----[ AFTER, ADD ]------------------------------------------
#
      'GROUP_LEGEND' => $group_legend,

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

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

#
#-----[ REPLACE WITH ]------------------------------------------
#
         // SIMPLE COLORED USERGROUPS MOD START
         $style_color = ($user_color = color_groups_user($row['user_id'])) ? 'style="font-weight:bold;color: #' . $user_color . '" ' : '';
         $username = '<span ' . $style_color . '>' . $username . '</span>';
         // COLOR GROUPS END

#
#-----[ OPEN ]------------------------------------------
#
common.php

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

#
#-----[ BEFORE, ADD ]------------------------------------------
#
$color_groups = color_groups();

#
#-----[ OPEN ]------------------------------------------
#
groupcp.php

#
#-----[ FIND ]------------------------------------------
#
               message_die(GENERAL_ERROR, 'Could not update user level', '', __LINE__, __FILE__, $sql);
            }
         }
      }

#
#-----[ AFTER, ADD ]------------------------------------------
#
      // SIMPLE COLORED USERGROUPS MOD START
      if ( $userdata['group_priority'] == $group_id )
      {
         $sql = 'UPDATE ' . USERS_TABLE . ' SET group_priority = 0 WHERE user_id = ' . $userdata['user_id'];
         if ( !$db->sql_query($sql) )
         {
            message_die(GENERAL_ERROR, 'Could not reset group priority.', '', __LINE__, __FILE__, $sql);
         }
      }
      // COLOR GROUPS END

#
#-----[ FIND ]------------------------------------------
#
                  if ( $group_info['auth_mod'] )
                  {

#
#-----[ REPLACE WITH ]------------------------------------------
#
                  if ( $group_info['auth_mod'] || $userdata['user_level'] == ADMIN )
                  {
                     // SIMPLE COLORED USERGROUPS MOD START
                     $sql = "SELECT group_priority, user_id
                              FROM " . USERS_TABLE . "
                                 WHERE user_id IN ($sql_in)
                                    AND group_priority = $group_id";
                     if ( !$result = $db->sql_query($sql) )
                     {
                        message_die(GENERAL_ERROR, 'Could select group users.', '', __LINE__, __FILE__, $sql);
                     }
                     while ( $row = $db->sql_fetchrow($result) )
                     {
                        $sql = 'UPDATE ' . USERS_TABLE . ' SET group_priority = 0 WHERE user_id = ' . $row['user_id'];
                        if ( !$db->sql_query($sql) )
                        {
                           message_die(GENERAL_ERROR, 'Could not reset group priority.', '', __LINE__, __FILE__, $sql);
                        }
                     }
                     // COLOR GROUPS END

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

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

#
#-----[ BEFORE, ADD ]------------------------------------------
#
function color_groups()
{
   global $db, $board_config, $userdata;
   
   $groupdata = array();
   if ( $board_config['color_groups'] = true )
   {
      $rows = array();
      $group_users = array();
      $staff_sql = ($userdata['user_level'] == USER) ? 'AND g.group_type <> ' . GROUP_HIDDEN : '';
      $sql = "SELECT g.group_name, g.group_colors, ug.group_id, u.username, u.user_id, u.group_priority
         FROM " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug, " . USERS_TABLE . " u
            WHERE g.group_single_user != 1
               AND g.group_colored <> 0
               AND ug.user_pending = 0
               AND ug.group_id = g.group_id
               AND ug.user_id = u.user_id
               $staff_sql
                  ORDER BY g.group_order, g.group_name";
      if ( ! $result = $db->sql_query($sql) )
      {
         message_die(GENERAL_ERROR, 'Could not get group data from database', '', __LINE__, __FILE__, $sql);
      }
      while ( $row = $db->sql_fetchrow($result) )
      {
         $row['group_colors'] = unserialize($row['group_colors']);
         $rows[] = $row;
      }
      for($i = 0; $i < sizeof($rows); $i++)
      {
         $groupdata['userdata'][ $rows[$i]['user_id'] ] = array(
            'user_id' => $rows[$i]['user_id'],
            'username' => $rows[$i]['username'],
            'group_priority' => $rows[$i]['group_priority'],
         );
         $group_users[ $rows[$i]['group_id'] ][ $rows[$i]['user_id'] ] = $rows[$i]['user_id'];
         $groupdata['groupdata'][ $rows[$i]['group_id'] ] = array(
            'group_id' => $rows[$i]['group_id'],
            'group_color' => $rows[$i]['group_colors'],
            'group_name' => $rows[$i]['group_name'],
            'group_users' => $group_users[ $rows[$i]['group_id'] ],
         );
      }
   }
   return $groupdata;
}

function color_groups_user($user_id)
{
   global $userdata, $color_groups, $board_config;
   if ( ! $color_groups )
   {
      return false;
   }
   if ( ! is_array($color_groups['groupdata']) )
   {
      return false;
   }
   foreach ( $color_groups['groupdata'] AS $group_data )
   {
      if ( ! $userdata['session_logged_in'] )
      {
         $group_color = $group_data['group_color'][ $board_config['default_style'] ];
      }
      else
      {
         $group_color = $group_data['group_color'][ $userdata['user_style'] ];
      }
      if ( ! $group_color )
      {
         $match_found = false;
         foreach ( $group_data['group_color'] AS $color )
         {
            if ( ! $match_found )
            {
               if ( $color )
               {
                  $group_color = $color;
                  $match_found = true;
               }
            }
         }
      }
      if ( $color_groups['userdata'][$user_id]['group_priority'] == $group_data['group_id'] || ! $color_groups['userdata'][$user_id]['group_priority'] )
      {
         if ( in_array ( $user_id, $group_data['group_users'] ) )
         {
            return $group_color;
         }
      }
   }
   return false;
}

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

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

#
#-----[ REPLACE WITH ]------------------------------------------
#
            // SIMPLE COLORED USERGROUPS MOD START
            $style_color = ($user_color = color_groups_user($row['user_id'])) ? 'style="font-weight:bold;color: #' . $user_color . '" ' : '';
            // COLOR GROUPS END

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

#
#-----[ FIND ]------------------------------------------
#
      $group_moderator = $row['username'];
   }
   else
   {
      $group_moderator = '';
   }

#
#-----[ AFTER, ADD ]------------------------------------------
#
   // SIMPLE COLORED USERGROUPS MOD START
   // Select the template data
   $templatedata = array();
   $sql = "SELECT themes_id AS style_id, template_name AS style_name FROM " . THEMES_TABLE . " ORDER BY template_name";
   if (! $result = $db->sql_query($sql) )
   {
      message_die(GENERAL_ERROR, 'Unable to fetch styles data from database.', __LINE__, __FILE__, $sql);
   }
   while ( $row = $db->sql_fetchrow($result) )
   {
      $templatedata[] = $row;
   }
   $db->sql_freeresult($result);

   // Unserialize the group colors.
   $group_info['group_colors'] = unserialize($group_info['group_colors']);

   // Assign the template input boxs
   for ( $i = 0; $i < sizeof($templatedata); $i++ )
   {
      $template->assign_block_vars('styles_block', array(
         'STYLE_ID' => $templatedata[$i]['style_id'],
         'STYLE_NAME' => $templatedata[$i]['style_name'],
         'STYLE_COLOR' => $group_info['group_colors'][ $templatedata[$i]['style_id'] ],
      ));
   }

   // Assign the order dropdown
   $template->assign_block_vars('group_row', array(
      'GROUP_ID' => 0,
      'GROUP_NAME' => $lang['color_groups_order_top'],
      'CHECKED' => ( $group_info['group_order'] - 1 == 0 ) ? 'selected="selected"' : '',
   ));
   if ( is_array($color_groups['groupdata']) )
   {
      foreach ( $color_groups['groupdata'] AS $group_data )
      {
         $template->assign_block_vars('group_row', array(
            'GROUP_ID' => $group_data['group_id'],
            'GROUP_NAME' => '- ' . $group_data['group_name'],
            'CHECKED' => ( $group_info['group_order'] - 1 == $group_data['group_id'] ) ? 'selected="selected"' : '',
         ));
      }
   }
   // COLOR GROUPS END

#
#-----[ FIND ]------------------------------------------
#
'GROUP_MODERATOR' => $group_moderator,

#
#-----[ AFTER, ADD ]------------------------------------------
#
      // SIMPLE COLORED USERGROUPS MOD START
      'L_COLOR_FOR' => $lang['color_groups_for'],
      'L_COLOR_GROUPS' => $lang['color_groups'],
      'L_COLOR_GROUPS_ON' => $lang['color_groups_on'],
      'L_COLOR_GROUPS_ORDER' => $lang['color_groups_order'],
      'S_COLOR_GROUPS_ON_CHECKED' => ( $group_info['group_colored'] ) ? 'checked="checked"' : '',
      // COLOR GROUPS END

#
#-----[ FIND ]------------------------------------------
#
      //
      // Delete Group
      //

#
#-----[ BEFORE, ADD ]------------------------------------------
#
      // SIMPLE COLORED USERGROUPS MOD START
      $sql = "SELECT u.group_priority, u.user_id FROM " . USER_GROUP_TABLE . " ug, " . USERS_TABLE . " u
               WHERE ug.group_id = $group_id
                  AND u.user_id = ug.user_id";
      if ( !$result = $db->sql_query($sql) )
      {
         message_die(GENERAL_ERROR, 'Could select group users.', '', __LINE__, __FILE__, $sql);
      }
      while ( $row = $db->sql_fetchrow($result) )
      {
         if ( $row['group_priority'] == $group_id )
         {
            $sql = 'UPDATE ' . USERS_TABLE . ' SET group_priority = 0 WHERE user_id = ' . $row['user_id'];
            if ( !$db->sql_query($sql) )
            {
               message_die(GENERAL_ERROR, 'Could not reset group priority.', '', __LINE__, __FILE__, $sql);
            }
         }
      }
      // COLOR GROUPS END

#
#-----[ FIND ]------------------------------------------
#
$group_type = isset($HTTP_POST_VARS['group_type']) ? intval($HTTP_POST_VARS['group_type']) : GROUP_OPEN;

#
#-----[ BEFORE, ADD ]------------------------------------------
#
      // SIMPLE COLORED USERGROUPS MOD START
      $group_colors = array();
      $templatedata = array();
      $sql = "SELECT themes_id AS style_id, template_name AS style_name FROM " . THEMES_TABLE . " ORDER BY template_name";
      if (! $result = $db->sql_query($sql) )
      {
         message_die(GENERAL_ERROR, 'Unable to fetch styles data from database.', __LINE__, __FILE__, $sql);
      }
      while ( $row = $db->sql_fetchrow($result) )
      {
         $templatedata[] = $row;
      }
      $db->sql_freeresult($result);
      for ( $i = 0; $i < sizeof($templatedata); $i++)
      {
         $group_colors[ $templatedata[$i]['style_id'] ] = substr(htmlspecialchars($HTTP_POST_VARS[ 'color_' . $templatedata[$i]['style_id'] ]), 0, 6);
      }
      $group_colors = serialize($group_colors);
      $group_order = intval($HTTP_POST_VARS['color_group_order'] + 1);
      $group_colored_check = ( isset($HTTP_POST_VARS['group_colored']) ) ? 1 : 0;
      // COLOR GROUPS END

#
#-----[ FIND ]------------------------------------------
#
               $sql = "DELETE FROM " . USER_GROUP_TABLE . "
                  WHERE user_id = " . $group_info['group_moderator'] . "
                     AND group_id = " . $group_id;
               if ( !$db->sql_query($sql) )
               {
                  message_die(GENERAL_ERROR, 'Could not update group moderator', '', __LINE__, __FILE__, $sql);
               }

#
#-----[ AFTER, ADD ]------------------------------------------
#
               // SIMPLE COLORED USERGROUPS MOD START
               if ( $this_userdata['group_priority'] == $group_id )
               {
                  $sql = "UPDATE " . USERS_TABLE . " SET group_priority = 0 WHERE user_id = $group_moderator";
                  if ( !$db->sql_query($sql) )
                  {
                     message_die(GENERAL_ERROR, 'Could not insert new user-group info', '', __LINE__, __FILE__, $sql);
                  }
               }
               // COLOR GROUPS END

#
#-----[ FIND ]------------------------------------------
#
         $sql = "UPDATE " . GROUPS_TABLE . "
            SET group_type = $group_type, group_name = '" . str_replace("\'", "''", $group_name) . "', group_description = '" . str_replace("\'", "''", $group_description) . "', group_moderator = $group_moderator
            WHERE group_id = $group_id";

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

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, group_colored = '$group_colored_check', group_colors = '$group_colors', group_order = '$group_order'

#
#-----[ FIND ]------------------------------------------
#
         $sql = "INSERT INTO " . GROUPS_TABLE . " (group_type, group_name, group_description, group_moderator, group_single_user)

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

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, group_colored, group_colors, group_order

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

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

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, '$group_colored_check', '$group_colors', '$group_order'

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

#
#-----[ FIND ]------------------------------------------
#
      {L_GROUP_DELETE_CHECK}</td>
   </tr>
   <!-- END group_edit -->

#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- COLOR_GROUPS -->
   <tr>
     <th class="thHead" colspan="2">{L_COLOR_GROUPS}</th>
   </tr>
   <!-- BEGIN styles_block -->
   <tr>
     <td class="row1" width="38%"><span class="gen">{L_COLOR_FOR} {styles_block.STYLE_NAME}:</span></td>
     <td class="row2" width="62%">
      <input class="post" type="text" class="post" name="color_{styles_block.STYLE_ID}" maxlength="50" size="20" value="{styles_block.STYLE_COLOR}" />
     </td>
   </tr>
   <!-- END styles_block -->
   <tr>
     <td class="row1" width="38%"><span class="gen">{L_COLOR_GROUPS_ORDER}:</span></td>
     <td class="row2" width="62%">
      <select name="color_group_order">
         <!-- BEGIN group_row -->
         <option value="{group_row.GROUP_ID}" {group_row.CHECKED}>{group_row.GROUP_NAME}</option>
         <!-- END group_row -->
      </select>
     </td>
   </tr>
   <tr>
     <td class="row1" width="38%"><span class="gen">{L_COLOR_GROUPS_ON}:</span></td>
     <td class="row2" width="62%">
      <input type="checkbox" name="group_colored" value="{S_COLOR_GROUPS_ON}" {S_COLOR_GROUPS_ON_CHECKED} /> {L_COLOR_GROUPS_ON}
     </td>
   </tr>
<!-- COLOR_GROUPS -->

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

#
#-----[ FIND ]------------------------------------------
#
<td class="row1" align="center" valign="middle" rowspan="{%:1}"><img src="templates/subSilver/images/whosonline.gif" alt="{L_WHO_IS_ONLINE}" /></td>

#
#-----[ INCREMENT ]-------------------------------------
#
%:1

#
#-----[ 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>
  </tr>

#
#-----[ REPLACE WITH ]------------------------------------------
#
   <!-- SIMPLE COLORED USERGROUPS MOD BY Afterlife_69 (http://www.ugboards.com) AND kkroo (http://phpbb-login.sourceforge.net) START -->

   <td class="row1" align="left"><span class="gensmall">{TOTAL_USERS_ONLINE}<br />{RECORD_USERS}<br />{LOGGED_IN_USER_LIST}</span></td>
  </tr>
  <tr>
   <td class="row1" align="left"><span class="gensmall">{GROUP_LEGEND}</span></td>
  </tr>
   <!-- SIMPLE COLORED USERGROUPS MOD END START -->

#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php

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

#
#-----[ BEFORE, ADD ]------------------------------------------
#
//
// Simple Colored Usergroup MOD
//
$lang['Group_priority'] = 'User Group priority';
$lang['Not_in_group'] = 'You are not in any user groups';
$lang['color_groups_legend'] = 'Legend';

#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_admin.php

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

#
#-----[ BEFORE, ADD ]------------------------------------------
#
$lang['color_groups'] = 'Group Colors';
$lang['color_groups_for'] = 'Group color for';
$lang['color_groups_on'] = 'Apply group color to this groups members';
$lang['color_groups_order'] = 'Position after group on legend';
$lang['color_groups_order_top'] = 'Position First';

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

#
#-----[ FIND ]------------------------------------------
#
$user_avatar_type = ( empty($user_avatar_local) && $mode == 'editprofile' ) ? $userdata['user_avatar_type'] : '';

#
#-----[ AFTER, ADD ]------------------------------------------
#
   // SIMPLE COLORED USERGROUPS MOD START
   if ( $mode == 'editprofile' )
   {
      $matched = false;
      $group_priority = ( isset($HTTP_POST_VARS['group_priority']) ) ? intval($HTTP_POST_VARS['group_priority']) : 0;
      if ( is_array($color_groups['groupdata']) )
     {
        foreach($color_groups['groupdata'] AS $color_group)
         {
            if ( is_array($color_group['group_users']) )
            {
               if ( in_array($userdata['user_id'], $color_group['group_users']) && $color_group['group_id'] == $group_priority )
               {
                  $matched = true;
               }
            }
         }
         if ( ! $matched )
         {
            $group_priority = 0;
         }
     }
   }
   // COLOR GROUPS END

#
#-----[ FIND ]------------------------------------------
#
            SET " . $username_sql . $passwd_sql . "u
#
#-----[ IN-LINE FIND ]------------------------------------------
#
user_timezone = $user_timezone,

#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
group_priority = '$group_priority',
   
#
#-----[ FIND ]------------------------------------------
#
   if ( $user_id != $userdata['user_id'] )
   {
      $error = TRUE;
      $error_msg = $lang['Wrong_Profile'];
   }
#
#-----[ BEFORE, ADD ]------------------------------------------
#
   
   // SIMPLE COLORED USERGROUPS MOD START
   $group_values = '';
   $group_count = 0;
   foreach($color_groups['groupdata'] AS $color_group)
   {
      if ( in_array($userdata['user_id'], $color_group['group_users']) )
      {
         $group_priority_selected = ( $userdata['group_priority'] == $color_group['group_id'] ) ? ' selected="selected"' : '';
         $group_values .= '<option value="' . $color_group['group_id'] . '"' . $group_priority_selected . '>' . $color_group['group_name'] . '</option>';
         $group_count++;
      }
   }
   if ( $group_values && $group_count > 1)
   {
      $group_drop_down = '<select name="group_priority">' . $group_values . '</select>';
      $template->assign_block_vars('switch_color_groups', array());
   }
   else
   {
      $group_priority = 0;
   }
   // COLOR GROUPS END
   
#
#-----[ FIND ]------------------------------------------
#
      'DATE_FORMAT' => $user_dateformat,
#
#-----[ BEFORE, ADD ]------------------------------------------
#

      // SIMPLE COLORED USERGROUPS MOD START
      'GROUP_PRIORITY_SELECT' => $group_drop_down,
      // COLOR GROUPS END   
   
#
#-----[ FIND ]------------------------------------------
#
      'L_DATE_FORMAT' => $lang['Date_format'],
#
#-----[ BEFORE, ADD ]------------------------------------------
#

      // SIMPLE COLORED USERGROUPS MOD START
      'L_GROUP_PRIORITY' => $lang['Group_priority'],
      // COLOR GROUPS END   
   
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/profile_add_body.tpl
#
#-----[ FIND ]------------------------------------------
#
   <tr>
     <td class="row1"><span class="gen">{L_TIMEZONE}:</span></td>
     <td class="row2"><span class="gensmall">{TIMEZONE_SELECT}</span></td>
   </tr>

#
#-----[ AFTER, ADD ]------------------------------------------
#
   
   <!-- SIMPLE COLORED USERGROUPS MOD BY Afterlife_69 (http://www.ugboards.com) AND kkroo (http://phpbb-login.sourceforge.net) START -->
   <!-- BEGIN switch_color_groups -->
   <tr>
     <td class="row1"><span class="gen">{L_GROUP_PRIORITY}:</span></td>
     <td class="row2"><span class="gensmall">{GROUP_PRIORITY_SELECT}</span></td>
   </tr>
   <!-- END switch_color_groups -->
   <!-- SIMPLE COLORED USERGROUPS END -->

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


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

#
#-----[ AFTER, ADD ]------------------------------------------
#
   
      // SIMPLE COLORED USERGROUPS MOD START
      $group_priority = ( isset($HTTP_POST_VARS['group_priority']) ) ? intval($HTTP_POST_VARS['group_priority']) : 0;
      // COLOR GROUPS END

#
#-----[ FIND ]------------------------------------------
#
            SET " . $username_sql . $passwd_sql

#
#-----[ IN-LINE FIND ]------------------------------------------
#
user_timezone = $user_timezone,

#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
group_priority = '$group_priority',


#
#-----[ FIND ]------------------------------------------
#
      $icq = $this_userdata['user_icq'];

#
#-----[ BEFORE, ADD ]------------------------------------------
#

      // SIMPLE COLORED USERGROUPS MOD START
      foreach($color_groups['groupdata'] AS $color_group)
      {
         if ( in_array($this_userdata['user_id'], $color_group['group_users']) )
         {
            $group_priority_selected = ( $this_userdata['group_priority'] == $color_group['group_id'] ) ? ' selected="selected"' : '';
            $group_values .= '<option value="' . $color_group['group_id'] . '"' . $group_priority_selected . '>' . $color_group['group_name'] . '</option>';
            $group_count++;
         }
      }
      if ( $group_values && $group_count > 1)
      {
         $group_drop_down = '<select name="group_priority">' . $group_values . '</select>';
         $template->assign_block_vars('switch_color_groups', array());
      }
      else
      {
         $group_priority = 0;
      }
      // COLOR GROUPS END
      

#
#-----[ FIND ]------------------------------------------
#
         'DATE_FORMAT' => $user_dateformat,

#
#-----[ BEFORE, ADD ]------------------------------------------
#

         // SIMPLE COLORED USERGROUPS MOD START
         'GROUP_PRIORITY_SELECT' => $group_drop_down,
         // COLOR GROUPS END   

#
#-----[ FIND ]------------------------------------------
#
         'L_DATE_FORMAT' => $lang['Date_format'],

#
#-----[ BEFORE, ADD ]------------------------------------------
#
            
         // SIMPLE COLORED USERGROUPS MOD START
         'L_GROUP_PRIORITY' => $lang['Group_priority'],
         // COLOR GROUPS END   

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/admin/user_edit_body.tpl
#
#-----[ FIND ]------------------------------------------
#
   <tr>
     <td class="row1"><span class="gen">{L_TIMEZONE}</span></td>
     <td class="row2">{TIMEZONE_SELECT}</td>
   </tr>

#
#-----[ AFTER, ADD ]------------------------------------------
#
   
   <!-- SIMPLE COLORED USERGROUPS MOD BY Afterlife_69 (http://www.ugboards.com) AND kkroo (http://phpbb-login.sourceforge.net) START -->
   <!-- BEGIN switch_color_groups -->
   <tr>
     <td class="row1"><span class="gen">{L_GROUP_PRIORITY}:</span></td>
     <td class="row2"><span class="gensmall">{GROUP_PRIORITY_SELECT}</span></td>
   </tr>
   <!-- END switch_color_groups -->
   <!-- SIMPLE COLORED USERGROUPS END -->

#
#-----[ DIY INSTRUCTIONS ]---------------------------------------------
#
This will add a version checker for this MOD compatible with the
Advanced Version Check MOD, if you do not have this MOD you do not
HAVE to upload this file

copy root/admin/avc_mods/avc_scu.php to admin/avc_mods/avc_scu.php

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


Code:

<h1>{L_WELCOME}</h1>

<p>{L_ADMIN_INTRO}</p>

<h1>{L_FORUM_STATS}</h1>

<table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline">
  <tr>
   <th width="25%" nowrap="nowrap" height="25" class="thCornerL">{L_STATISTIC}</th>
   <th width="25%" height="25" class="thTop">{L_VALUE}</th>
   <th width="25%" nowrap="nowrap" height="25" class="thTop">{L_STATISTIC}</th>
   <th width="25%" height="25" class="thCornerR">{L_VALUE}</th>
  </tr>
  <tr>
   <td class="row1" nowrap="nowrap">{L_NUMBER_POSTS}:</td>
   <td class="row2"><b>{NUMBER_OF_POSTS}</b></td>
   <td class="row1" nowrap="nowrap">{L_POSTS_PER_DAY}:</td>
   <td class="row2"><b>{POSTS_PER_DAY}</b></td>
  </tr>
  <tr>
   <td class="row1" nowrap="nowrap">{L_NUMBER_TOPICS}:</td>
   <td class="row2"><b>{NUMBER_OF_TOPICS}</b></td>
   <td class="row1" nowrap="nowrap">{L_TOPICS_PER_DAY}:</td>
   <td class="row2"><b>{TOPICS_PER_DAY}</b></td>
  </tr>
  <tr>
   <td class="row1" nowrap="nowrap">{L_NUMBER_USERS}:</td>
   <td class="row2"><b>{NUMBER_OF_USERS}</b></td>
   <td class="row1" nowrap="nowrap">{L_USERS_PER_DAY}:</td>
   <td class="row2"><b>{USERS_PER_DAY}</b></td>
  </tr>
  <tr>
   <td class="row1" nowrap="nowrap">{L_BOARD_STARTED}:</td>
   <td class="row2"><b>{START_DATE}</b></td>
   <td class="row1" nowrap="nowrap">{L_AVATAR_DIR_SIZE}:</td>
   <td class="row2"><b>{AVATAR_DIR_SIZE}</b></td>
  </tr>
  <tr>
   <td class="row1" nowrap="nowrap">{L_DB_SIZE}:</td>
   <td class="row2"><b>{DB_SIZE}</b></td>
   <td class="row1" nowrap="nowrap">{L_GZIP_COMPRESSION}:</td>
   <td class="row2"><b>{GZIP_COMPRESSION}</b></td>
  </tr>
</table>

<h1>{L_VERSION_INFORMATION}</h1>

{VERSION_INFO}

<br />

<h1>{L_WHO_IS_ONLINE}</h1>

<table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline">
  <tr>
   <th width="20%" class="thCornerL" height="25">&nbsp;{L_USERNAME}&nbsp;</th>
   <th width="20%" height="25" class="thTop">&nbsp;{L_STARTED}&nbsp;</th>
   <th width="20%" class="thTop">&nbsp;{L_LAST_UPDATE}&nbsp;</th>
   <th width="20%" class="thCornerR">&nbsp;{L_FORUM_LOCATION}&nbsp;</th>
   <th width="20%" height="25" class="thCornerR">&nbsp;{L_IP_ADDRESS}&nbsp;</th>
  </tr>
  <!-- BEGIN reg_user_row -->
  <tr>
   <td width="20%" class="{reg_user_row.ROW_CLASS}">&nbsp;<span class="gen"><a href="{reg_user_row.U_USER_PROFILE}" class="gen">{reg_user_row.USERNAME}</a></span>&nbsp;</td>
   <td width="20%" align="center" class="{reg_user_row.ROW_CLASS}">&nbsp;<span class="gen">{reg_user_row.STARTED}</span>&nbsp;</td>
   <td width="20%" align="center" nowrap="nowrap" class="{reg_user_row.ROW_CLASS}">&nbsp;<span class="gen">{reg_user_row.LASTUPDATE}</span>&nbsp;</td>
   <td width="20%" class="{reg_user_row.ROW_CLASS}">&nbsp;<span class="gen"><a href="{reg_user_row.U_FORUM_LOCATION}" class="gen">{reg_user_row.FORUM_LOCATION}</a></span>&nbsp;</td>
   <td width="20%" class="{reg_user_row.ROW_CLASS}">&nbsp;<span class="gen"><a href="{reg_user_row.U_WHOIS_IP}" class="gen" target="_phpbbwhois">{reg_user_row.IP_ADDRESS}</a></span>&nbsp;</td>
  </tr>
  <!-- END reg_user_row -->
  <tr>
   <td colspan="5" height="1" class="row3"><img src="../templates/subSilver/images/spacer.gif" width="1" height="1" alt="."></td>
  </tr>
  <!-- BEGIN guest_user_row -->
  <tr>
   <td width="20%" class="{guest_user_row.ROW_CLASS}">&nbsp;<span class="gen">{guest_user_row.USERNAME}</span>&nbsp;</td>
   <td width="20%" align="center" class="{guest_user_row.ROW_CLASS}">&nbsp;<span class="gen">{guest_user_row.STARTED}</span>&nbsp;</td>
   <td width="20%" align="center" nowrap="nowrap" class="{guest_user_row.ROW_CLASS}">&nbsp;<span class="gen">{guest_user_row.LASTUPDATE}</span>&nbsp;</td>
   <td width="20%" class="{guest_user_row.ROW_CLASS}">&nbsp;<span class="gen"><a href="{guest_user_row.U_FORUM_LOCATION}" class="gen">{guest_user_row.FORUM_LOCATION}</a></span>&nbsp;</td>
   <td width="20%" class="{guest_user_row.ROW_CLASS}">&nbsp;<span class="gen"><a href="{guest_user_row.U_WHOIS_IP}" target="_phpbbwhois">{guest_user_row.IP_ADDRESS}</a></span>&nbsp;</td>
  </tr>
  <!-- END guest_user_row -->
</table>

<br />
Back to Top
View user's profile Find all posts by Karen Send private message   Visit poster's website Phoogle Map
Re: Simple Colour Usergroups
PostPosted: 06/21/2007 5:19 AM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30757
Word Cnt. 2,628,690
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 6:30 PM
Location: St Pete, FL
peace.gif
I just checked and all the code appears to be added exactly as specified.  This is the new color groups on your Index page:



But since it is clear that the MOD isn't working correctly in Profile Edit and Admin Group-Users, then there are flaws to find.  Is this a Beta MOD???

dontknow
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
Re: Simple Colour Usergroups
PostPosted: 06/21/2007 5:39 AM Reply with quote
Citation
Karen
Citation
Posts 1253
Word Cnt. 68,166
BDay Nov 9
Sign Scorpio
Sex Sex:Female
Joined: Jan 06, 2006
Local time: 10:30 PM
greatbrE.gif
No its a databse release on phpbb.com http://www.phpbb.com/community/viewtopic.php?f=15&t=416842&hilit=simpl e+color+usergroups

Have you done something because the extra field has gone now  headbang
Back to Top
View user's profile Find all posts by Karen Send private message   Visit poster's website Phoogle Map
Re: Simple Colour Usergroups
PostPosted: 06/21/2007 5:56 AM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30757
Word Cnt. 2,628,690
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 6:30 PM
Location: St Pete, FL
peace.gif
Yes, I removed the duplicate code from your group_edit_body.tpl file.  I haven't found the cause of why the other fields aren't displaying though and now it's time for me to hit the sack.  So I may have to pick this up again after I've gotten some rest...

munky2
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
Re: Simple Colour Usergroups
PostPosted: 06/21/2007 7:23 AM Reply with quote
Citation
Karen
Citation
Posts 1253
Word Cnt. 68,166
BDay Nov 9
Sign Scorpio
Sex Sex:Female
Joined: Jan 06, 2006
Local time: 10:30 PM
greatbrE.gif
Great thank you again! Have a good sleep!

Its working ok so I don't think there are any other fields to sort out.

occasion9
Back to Top
View user's profile Find all posts by Karen Send private message   Visit poster's website Phoogle Map
Re: Simple Colour Usergroups
PostPosted: 06/21/2007 4:10 PM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30757
Word Cnt. 2,628,690
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 6:30 PM
Location: St Pete, FL
peace.gif
It is working correctly?  I thought the settings were missing from the profile and user edit pages???

dontknow
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
Re: Simple Colour Usergroups
PostPosted: 06/21/2007 4:32 PM Reply with quote
Citation
Karen
Citation
Posts 1253
Word Cnt. 68,166
BDay Nov 9
Sign Scorpio
Sex Sex:Female
Joined: Jan 06, 2006
Local time: 10:30 PM
greatbrE.gif
Yep seems to be fine! When I went checking the code changes I couldn't find some that Em said it had done, but it must've I guess. The only thing that doesn't seem to work all the time is where you place the groups (first or after one of the other groups in the legend).

Would it be possible to get the top posters colours to tie in with this or would it be possible to manually change the colours of the  staff members/members?
At the moment I show as purple but according to the other I'm red if you see what I mean?
Same for the last visited in the past 24 hours...I think it would be near on impossible wouldn't it? Or what about taking out the colours from that and having just one colour for all? Is that possible?  sunny
Back to Top
View user's profile Find all posts by Karen Send private message   Visit poster's website Phoogle Map
Re: Simple Colour Usergroups
PostPosted: 06/22/2007 5:08 AM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30757
Word Cnt. 2,628,690
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 6:30 PM
Location: St Pete, FL
peace.gif
Yes, I'm sure it is possible to integrate the functionality of this MOD with the rest of the member names that aren't currently being set to the correct color.  Hopefully tomorrow I can help you figure out how.  I need to call it a night now before I pass out at the keyboard...

Rolling Eyes
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
Re: Simple Colour Usergroups
PostPosted: 06/22/2007 6:14 AM Reply with quote
Citation
Karen
Citation
Posts 1253
Word Cnt. 68,166
BDay Nov 9
Sign Scorpio
Sex Sex:Female
Joined: Jan 06, 2006
Local time: 10:30 PM
greatbrE.gif
That would be great  headbang
Much appreciated!
Back to Top
View user's profile Find all posts by Karen Send private message   Visit poster's website Phoogle Map
Re: Simple Colour Usergroups
PostPosted: 06/22/2007 11:08 PM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30757
Word Cnt. 2,628,690
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 6:30 PM
Location: St Pete, FL
peace.gif
Ok, check it out now.  There were too many modifications to list them all here...

munky2
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
 Post new topic  Reply to topic
Information
Welcome to RCF - WHF Forum Index -> Area 51 - phpBB & Easymod Tech Support

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 cannot download files in this forum
All times are GMT - 5 Hours
Goto page: 1, 2, 3  Next
Page 1 of 3


Add To Bookmarks

 
  
  


  Google

Powered by phpBB © 2001, 2005 phpBB Group

Page generation time: 0.1902s (PHP: 82% - SQL: 18%) - SQL queries: 57 - GZIP disabled - Debug on