Simple Colored Usergroups

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.

Rating:

Excellent!
29
66%
Very Good
8
18%
Good
3
7%
Fair
1
2%
Poor
3
7%
 
Total votes: 44

User avatar
Ornette
Registered User
Posts: 56
Joined: Thu Mar 06, 2008 3:53 pm

Re: Simple Colored Usergroups

Post by Ornette »

Version 2

Code: Select all

##############################################################
## MOD Title:       Simple Colored Usergroups
## MOD Author:      kkroo < princeomz2004@hotmail.com > (Omar Ramadan) http://phpbb-login.sourceforge.net
## MOD Author:      Afterlife_69 < afterlife_69@hotmail.com > (Dean Newman) http://www.ugboards.com
## MOD Author:		Ornette <> (Ornette Wilson) http://www.stressfactor.co.uk
## MOD Description: Replaces the current username coloring with a group based system like in Olympus (phpBB3).
## MOD Version:     2.0.0
## 
## Installation Level:  Intermediate
## Installation Time:   2 hours
## Files To Edit:   24
##              common.php
##              includes/functions.php
##              includes/page_header.php
##              index.php
##              templates/subSilver/index_body.tpl
##              groupcp.php
##              templates/subSilver/groupcp_info_body.tpl
##              memberlist.php
##              templates/subSilver/memberlist_body.tpl
##              privmsg.php
##              templates/subSilver/privmsgs_body.tpl
##              search.php
##              viewforum.php
##              viewonline.php
##              templates/subSilver/viewonline_body.tpl
##              viewtopic.php
##              admin/admin_groups.php
##              templates/subSilver/admin/group_edit_body.tpl
##              admin/admin_users.php
##              templates/subSilver/admin/user_edit_body.tpl
##              includes/usercp_register.php
##              templates/subSilver/profile_add_body.tpl
##              language/lang_english/lang_main.php
##              language/lang_english/lang_admin.php
##
## Included Files:  n/a
##
## 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:
##
## Version 2.0.0
## new:
## 2008-08-01
## added group hidden to group data array
## created colored_group() function to check for group colour, used twice by index.php
## and viewforum.php, with some cleaner code too
## changed index legend builder to take note of group hidden status
##
## added group_rank_priority to SQL 
## added checkbox to admin_groups
## changed logic in viewtopic.php to override user's own rank if selected
##
## now group name appears in colour in group_cp.php
##
## reordered file edits in this mod, grouping file edits with their template edits 
##
## prior:
## 2008-07-31
## removed the version checker
##
## fixed the drop down boxes on edit profiles to have a default, non selected option
## (if you dont want a custom group priority), with a nice $lang varaiable
##
## moved the drop down box creator in admin_users.php much higher up from line 759 to 268, 
## pretty much to the top of the page (it will always get created that way)
## to fix bug that box does not appear if there is an error on submit
## i'm not sure if this makes for any other problems...
##
## changed both index.php & color_group_users() function to use $theme['theme_id']  value instead
## of silly logic to decide whether to use $board_config['default_style'] or $userdata['user_style']
## this involved changing global to $theme..
## this i noticed caused bug where if more than one theme color defined, the mod uses the color of 
## users default style even if board style is set to override.
##
## changed SQL & color_gropus() to pick up a group rank field, with entries in admin_groups.php
## to facilitate this
## we will define a group rank here
##
## changed around logic in index.php when building the group legend, my new method is neater?
## simlar fix to color_group_users()... tidier
## changed around logic in color_groups() when building the arrays, my new method is neater?
##
## integrated SCU_global.mod
## moved common.php edits to top of this mod file
##
##
##	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 ]------------------------------------------
#
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 smallint(5) NOT NULL;
ALTER TABLE phpbb_groups ADD group_rank smallint(5) NOT NULL;
ALTER TABLE phpbb_groups ADD group_rank_priority tinyint(1) NOT NULL;
ALTER TABLE phpbb_users ADD group_priority mediumint(8) NOT NULL;

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

#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// Start: Simple Colored Usergroups MOD v2
$color_groups = color_groups();
// End: Simple Colored Usergroups MOD v2

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

#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// Start: Simple Colored Usergroups MOD v2
function color_groups()
{
	global $db, $board_config, $userdata;
	
	$groupdata = array();
	if ( $board_config['color_groups'] = true )
	{
		$rows = array();
		$group_users = array();
		$sql = "SELECT g.group_name, g.group_order, g.group_colors, g.group_type, g.group_rank_priority, r.rank_title, r.rank_image, ug.group_id, u.username, u.user_id, u.group_priority
			FROM " . GROUPS_TABLE . " g LEFT JOIN " . RANKS_TABLE . " r on r.rank_id = g.group_rank and r.rank_special = 1, ". 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

						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']);
            
			$groupdata['userdata'][ $row['user_id'] ] = 
                array(
                    'user_id' => $row['user_id'],
                    'username' => $row['username'],
                    'group_priority' => $row['group_priority'],
                );            
                
			$group_users[ $row['group_id'] ][ $row['user_id'] ] = true;    
            
			$groupdata['groupdata'][ $row['group_id'] ] = 
                array(
                    'group_id' => $row['group_id'],
                    'group_type' => $row['group_type'],
                    'group_color' => $row['group_colors'],
                    'group_rank_priority' => $row['group_rank_priority'],
                    'group_rank_title' => $row['rank_title'],
                    'group_rank_image' => $row['rank_image'],
                    'group_name' => $row['group_name'],
                    'group_users' => $group_users[ $row['group_id'] ],
                );

		}
	}
	return $groupdata;
}

function color_groups_user($user_id, $ranks = false)
{
	global $userdata, $color_groups, $theme;
    
	if ( ! $color_groups || !is_array($color_groups['groupdata']) )
	{
		return false;
	}

	foreach ( $color_groups['groupdata'] AS $group_data )
	{

        $group_color = $group_data['group_color'][$theme['themes_id']];


		if ( ! $group_color )
		{
			foreach ( $group_data['group_color'] AS $color )
			{
                if ( $color )
                {
                    $group_color = $color;
                    break;
                }
			}
		}
        
		if ( $color_groups['userdata'][$user_id]['group_priority'] == $group_data['group_id'] || ! $color_groups['userdata'][$user_id]['group_priority'] )
		{
			if ( $group_data['group_users'][$user_id] )
			{
                if ($ranks) 
                {
                    return array(
                        'group_color' => $group_color, 
                        'group_rank_priority' => $group_data['group_rank_priority'],
                        'group_rank_title' => $group_data['group_rank_title'],
                        'group_rank_image' => $group_data['group_rank_image'],
                        );
                }
				return $group_color;
			}
		}
	}
	return false;
}

function colored_group($group_id)
{
    global $color_groups, $theme;
    
    $group_color_data = $color_groups['groupdata'][$group_id]['group_color'];
    
    if (is_array($group_color_data))
    {
        $group_color = $group_color_data[$theme['themes_id']];
    
        if ( ! $group_color )
        {
            foreach ( $group_color_data AS $color )
            {
                if ( $color ) 
                {
                    $group_color = $color;
                    break;
                }
            }
        }
    }
    
    return $group_color;
}
// End: Simple Colored Usergroups MOD v2

#
#-----[ 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 ]------------------------------------------
#
                // Start: Simple Colored Usergroups MOD v2
				$style_color = ($user_color = color_groups_user($row['user_id'])) ? 'style="font-weight:bold;color: #' . $user_color . '" ' : '';
                // End: Simple Colored Usergroups MOD v2
#
#-----[ OPEN ]------------------------------------------
#
index.php

#
#-----[ FIND ]------------------------------------------
#
$newest_user = $newest_userdata['username'];
#
#-----[ BEFORE, ADD ]------------------------------------------
#
        // Start: Simple Colored Usergroups MOD v2
		$newest_user_color = ($user_color = color_groups_user($newest_userdata['user_id'])) ? 'style="font-weight:bold;color: #' . $user_color . '" ' : '';
        // End: Simple Colored Usergroups MOD v2
        
#
#-----[ FIND ]------------------------------------------
#
		$forum_moderators[$row['forum_id']][] = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '">' . $row['username'] . '</a>';
#
#-----[ BEFORE, ADD ]------------------------------------------
#
        // Start: Simple Colored Usergroups MOD v2
	    $mod_color = ($user_color = color_groups_user($row['user_id'])) ? 'style="font-weight:bold;color: #' . $user_color . '" ' : '';
        // End: Simple Colored Usergroups MOD v2

#
#-----[ IN-LINE FIND ]------------------------------------------
#
href="
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
' . $mod_color . '
#
#-----[ FIND ]------------------------------------------
#
		$forum_moderators[$row['forum_id']][] = '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $row['group_id']) . '">' . $row['group_name'] . '</a>';
#
#-----[ BEFORE, ADD ]------------------------------------------
#
        // Start: Simple Colored Usergroups MOD v2
        $group_color = colored_group($row['group_id']);
        
		$mod_group_color = ( $group_color ) ? 'style="font-weight:bold;font-style:italic;color: #' . $group_color . '" ' : '';
        // End: Simple Colored Usergroups MOD v2
        
#
#-----[ IN-LINE FIND ]------------------------------------------
#
href="
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
' . $mod_group_color . '
#
#-----[ FIND ]------------------------------------------
#
	$template->set_filenames(array(
		'body' => 'index_body.tpl')
	);
    
#
#-----[ AFTER, ADD ]------------------------------------------
#
    // Start: Simple Colored Usergroups MOD v2
    foreach($color_groups['groupdata'] AS $group_id => $group_data)
    {
        if ($group_data['group_type'] == GROUP_HIDDEN && $userdata['user_level'] == USER) continue;
        
        $group_color = colored_group($group_id); 
        
        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);
	
	$group_legend = $lang['color_groups_legend'] . ': ' . ( ($group_legend)? $group_legend : $lang['No_groups_exist'] );
    // End: Simple Colored Usergroups MOD v2

#
#-----[ FIND ]------------------------------------------
#
		'NEWEST_USER' => sprintf($lang['Newest_user'], '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid") . '">', $newest_user, '</a>'), 

#
#-----[ IN-LINE FIND ]------------------------------------------
#
href="
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
' . $newest_user_color . '
#
#-----[ FIND ]------------------------------------------
#
'FORUM_LOCKED_IMG' => $images['forum_locked'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
        // Start: Simple Colored Usergroups MOD v2
        'GROUP_LEGEND' => $group_legend,
        // End: Simple Colored Usergroups MOD v2
#
#-----[ FIND ]------------------------------------------
#	
								$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? 
#
#-----[ BEFORE, ADD ]------------------------------------------
#
                                // Start: Simple Colored Usergroups MOD v2
								$style_color = ($user_color = color_groups_user($forum_data[$j]['user_id'])) ? 'style="font-weight:bold;color: #' . $user_color . '" ' : '';
                                // End: Simple Colored Usergroups MOD v2
#
#-----[ IN-LINE FIND ]------------------------------------------
#
href="
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
' . $style_color . '
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/index_body.tpl

#
#-----[ FIND ]------------------------------------------
#
<td class="row1" align="center" valign="middle" rowspan="{%:1}"
#
#-----[ 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 ]------------------------------------------
#
groupcp.php

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

#
#-----[ AFTER, ADD ]------------------------------------------
#
        // Start: Simple Colored Usergroups MOD v2
		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);
			}
		}
        // End: Simple Colored Usergroups MOD v2
#
#-----[ FIND ]------------------------------------------
#
						if ( $group_info['auth_mod'] )
						{
#
#-----[ REPLACE WITH ]------------------------------------------
#
                        // Edited: Simple Colored Usergroups MOD v2
						if ( $group_info['auth_mod'] || $userdata['user_level'] == ADMIN )
                        // End: Simple Colored Usergroups MOD v2
                        {
                            // Start: Simple Colored Usergroups MOD v2

							$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);
								}
							}
                            // End: Simple Colored Usergroups MOD v2
# 
#-----[ FIND ]------------------------------------------
#
	$s_hidden_fields .= '
	$template->assign_vars(array(
#
#-----[ BEFORE, ADD ]------------------------------------------
#
    // Start: Simple Colored Usergroups MOD v2
    $group_name = $group_info['group_name'];
    $group_color = colored_group($group_id); 
    
    if ( $group_color )
    {
        $group_name = '<span style="font-weight: bold; color: #' . $group_color . '">' . $group_name . '</span>';
    }        
    
	$username_style = ($user_color = color_groups_user($user_id)) ? ' style="font-weight:bold;color: #' . $user_color . '"' : '';
    // End: Simple Colored Usergroups MOD v2
    
# 
#-----[ FIND ]------------------------------------------
#
        'GROUP_NAME' => $group_info['group_name'],
#
#-----[ REPLACE WITH ]------------------------------------------
#
        // Edited: Simple Colored Usergroups MOD v2
        'GROUP_NAME' => $group_name,
        // End: Simple Colored Usergroups MOD v2
# 
#-----[ FIND ]------------------------------------------
#
		'MOD_USERNAME' => $username,
#
#-----[ AFTER, ADD ]------------------------------------------
#
        // Start: Simple Colored Usergroups MOD v2
        'MOD_USERNAME_STYLE' => $username_style,
        // End: Simple Colored Usergroups MOD v2
# 
#-----[ FIND ]------------------------------------------
#
			$template->assign_block_vars('member_row', array(
#
#-----[ BEFORE, ADD ]------------------------------------------
#
            // Start: Simple Colored Usergroups MOD v2
			$username_style = ($user_color = color_groups_user($user_id)) ? ' style="font-weight:bold;color: #' . $user_color . '"' : '';
            // End: Simple Colored Usergroups MOD v2
            
#
#-----[ FIND ]------------------------------------------
#
				'USERNAME' => $username,
#
#-----[ AFTER, ADD ]------------------------------------------
#
                // Start: Simple Colored Usergroups MOD v2
                'USERNAME_STYLE' => $username_style,
                // End: Simple Colored Usergroups MOD v2
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/groupcp_info_body.tpl

#
#-----[ FIND ]------------------------------------------
#
	  <td class="row1" align="center"><span class="gen"><a href="{U_MOD_VIEWPROFILE}" class="gen">{MOD_USERNAME}</a></span></td>
#
#-----[ IN-LINE FIND ]------------------------------------------
#
>{MOD_USERNAME}</a>
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
{MOD_USERNAME_STYLE}
#
#-----[ FIND ]------------------------------------------
#
	  <td class="{member_row.ROW_CLASS}" align="center"><span class="gen"><a href="{member_row.U_VIEWPROFILE}" class="gen">{member_row.USERNAME}</a></span></td>
#
#-----[ IN-LINE FIND ]------------------------------------------
#
>{member_row.USERNAME}</a>
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
{member_row.USERNAME_STYLE}
#
#-----[ OPEN ]------------------------------------------
#
memberlist.php

# 
#-----[ FIND ]------------------------------------------
#
		$template->assign_block_vars('memberrow', array(
#
#-----[ BEFORE, ADD ]------------------------------------------
#
        // Start: Simple Colored Usergroups MOD v2
		$username_style = ($user_color = color_groups_user($user_id)) ? ' style="font-weight:bold;color: #' . $user_color . '"' : '';
        // End: Simple Colored Usergroups MOD v2
        
#
#-----[ FIND ]------------------------------------------
#
			'USERNAME' => $username,
#
#-----[ AFTER, ADD ]------------------------------------------
#
            // Start: Simple Colored Usergroups MOD v2
			'USERNAME_STYLE' => $username_style,
            // End: Simple Colored Usergroups MOD v2
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/memberlist_body.tpl

#
#-----[ FIND ]------------------------------------------
#
            	  <td class="{memberrow.ROW_CLASS}" align="center"><span class="gen"><a href="{memberrow.U_VIEWPROFILE}" class="gen">{memberrow.USERNAME}</a></span></td>
#
#-----[ IN-LINE FIND ]------------------------------------------
#
>{memberrow.USERNAME}</a>
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
{memberrow.USERNAME_STYLE}
#
#-----[ OPEN ]------------------------------------------
#
search.php

#
#-----[ FIND ]------------------------------------------
#
				$poster = ( $searchset[$i]['user_id'] != ANONYMOUS ) ? '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $searchset[$i]['user_id']) . '">' : '';
#
#-----[ BEFORE, ADD ]------------------------------------------
#
                // Start: Simple Colored Usergroups MOD v2
				$style_color = ($user_color = color_groups_user($searchset[$i]['user_id'])) ? 'style="font-weight:bold;color: #' . $user_color . '" ' : '';
                // End: Simple Colored Usergroups MOD v2

#
#-----[ IN-LINE FIND ]------------------------------------------
#
href="
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
' . $style_color . '
# 
#-----[ FIND ]------------------------------------------
#
				$topic_author = ( $searchset[$i]['user_id'] != ANONYMOUS ) ? '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $searchset[$i]['user_id']) . '">' : '';
#
#-----[ BEFORE, ADD ]------------------------------------------
#
                // Start: Simple Colored Usergroups MOD v2
				$style_color = ($user_color = color_groups_user($searchset[$i]['user_id'])) ? 'style="font-weight:bold;color: #' . $user_color . '" ' : '';
                // End: Simple Colored Usergroups MOD v2

#
#-----[ IN-LINE FIND ]------------------------------------------
#
href="
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
' . $style_color . '
# 
#-----[ FIND ]------------------------------------------
#
				$last_post_author = ( $searchset[$i]['id2'] == ANONYMOUS ) ? ( ($searchset[$i]['post_username2'] != '' ) ? $searchset[$i]['post_username2'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $searchset[$i]['id2']) . '">' . $searchset[$i]['user2'] . '</a>';
#
#-----[ BEFORE, ADD ]------------------------------------------
#
                // Start: Simple Colored Usergroups MOD v2
				$style_color = ($user_color = color_groups_user($searchset[$i]['id2'])) ? 'style="font-weight:bold;color: #' . $user_color . '" ' : '';
                // End: Simple Colored Usergroups MOD v2
#
#-----[ IN-LINE FIND ]------------------------------------------
#
href="
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
' . $style_color . '
#
#-----[ OPEN ]------------------------------------------
#
privmsg.php

#
#-----[ FIND ]------------------------------------------
#
		$u_from_user_profile = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$msg_userid");
#
#-----[ BEFORE, ADD ]------------------------------------------
#
        // Start: Simple Colored Usergroups MOD v2
	    $u_from_user_profile_style = ($user_color = color_groups_user($msg_userid)) ? 'style="font-weight:bold;color: #' . $user_color . '" ' : '';
        // End: Simple Colored Usergroups MOD v2

#
#-----[ FIND ]------------------------------------------
#
			'U_FROM_USER_PROFILE' => $u_from_user_profile)
#
#-----[ BEFORE, ADD ]------------------------------------------
#
			'U_FROM_USER_PROFILE_STYLE' => $u_from_user_profile_style,
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/privmsgs_body.tpl

#
#-----[ FIND ]------------------------------------------
#
	  <td width="20%" valign="middle" align="center" class="{listrow.ROW_CLASS}"><span class="name">&nbsp;<a href="{listrow.U_FROM_USER_PROFILE}"
#
#-----[ IN-LINE FIND ]------------------------------------------
#
href="
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
{listrow.U_FROM_USER_PROFILE_STYLE}
#
#-----[ OPEN ]------------------------------------------
#
viewforum.php

#
#-----[ FIND ]------------------------------------------
#
	$moderators[] = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '">' . $row['username'] . '</a>';
#
#-----[ BEFORE, ADD ]------------------------------------------
#
    // Start: Simple Colored Usergroups MOD v2
	$mod_color = ($user_color = color_groups_user($row['user_id'])) ? 'style="font-weight:bold;color: #' . $user_color . '" ' : '';
    // End: Simple Colored Usergroups MOD v2

#
#-----[ IN-LINE FIND ]------------------------------------------
#
href="
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
' . $mod_color . '
#
#-----[ FIND ]------------------------------------------
#
	$moderators[] = '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $row['group_id']) . '">' . $row['group_name'] . '</a>';
#
#-----[ BEFORE, ADD ]------------------------------------------
#
    // Start: Simple Colored Usergroups MOD v2
    $group_color = colored_group($row['group_id']);	
	$mod_group_color = ( !empty( $group_color ) ) ? 'style="font-weight:bold;font-style:italic; color: #' . $group_color . '" ' : '';
    // End: Simple Colored Usergroups MOD v2

#
#-----[ IN-LINE FIND ]------------------------------------------
#
href="
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
' . $mod_group_color . '
#
#-----[ FIND ]------------------------------------------
#
		$topic_author = ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $topic_rowset[$i]['user_id']) . '">' : '';
#
#-----[ BEFORE, ADD ]------------------------------------------
#
        // Start: Simple Colored Usergroups MOD v2
		$style_color = ($user_color = color_groups_user($topic_rowset[$i]['user_id'])) ? 'style="font-weight:bold;color: #' . $user_color . '" ' : '';
        // End: Simple Colored Usergroups MOD v2

#
#-----[ IN-LINE FIND ]------------------------------------------
#
href="
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
' . $style_color . '
#
#-----[ FIND ]------------------------------------------
#
		$last_post_author = ( $topic_rowset[$i]['id2'] == ANONYMOUS ) ? ( ($topic_rowset[$i]['post_username2'] != '' ) ? $topic_rowset[$i]['post_username2'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $topic_rowset[$i]['id2']) . '">' . $topic_rowset[$i]['user2'] . '</a>';
#
#-----[ BEFORE, ADD ]------------------------------------------
#
        // Start: Simple Colored Usergroups MOD v2
		$style_color = ($user_color = color_groups_user($topic_rowset[$i]['id2'])) ? 'style="font-weight:bold;color: #' . $user_color . '" ' : '';
        // End: Simple Colored Usergroups MOD v2

#
#-----[ IN-LINE FIND ]------------------------------------------
#
href="
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
' . $style_color . '
#
#-----[ 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 ]------------------------------------------
#
            // Edited: Simple Colored Usergroups MOD v2
			$username_style = ($user_color = color_groups_user($row['user_id'])) ? 'style="font-weight:bold;color: #' . $user_color . '" ' : '';
            // End: Simple Colored Usergroups MOD v2
#
#-----[ FIND ]------------------------------------------
#
			'USERNAME' => $username,
#
#-----[ AFTER, ADD ]------------------------------------------
#
            // Edited: Simple Colored Usergroups MOD v2
            'USERNAME_STYLE' => $username_style,
            // End: Simple Colored Usergroups MOD v2
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/viewonline_body.tpl

#
#-----[ FIND ]------------------------------------------
#
	<td width="35%" 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>
#
#-----[ IN-LINE FIND ]------------------------------------------
#
>{reg_user_row.USERNAME}</a>
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
{reg_user_row.USERNAME_STYLE}
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php

#
#-----[ FIND ]------------------------------------------
#
	$poster_id = $postrow[$i]['user_id'];
    
#
#-----[ AFTER, ADD ]------------------------------------------
#
    // Start: Simple Colored Usergroups MOD v2
    $user_color = color_groups_user($poster_id, true);
    // End: Simple Colored Usergroups MOD v2
#
#-----[ FIND ]------------------------------------------
#
	//
	// Generate ranks, set them to empty string initially.
	//
	$poster_rank = '';
	$rank_image = '';

#
#-----[ AFTER, ADD ]------------------------------------------
#
    // Start: Simple Colored Usergroups MOD v2
    if ($user_color['group_rank_title'])
    {
        $poster_rank = $user_color['group_rank_title'];
        $rank_image = ( $user_color['group_rank_image'] ) ? '<img src="' . $user_color['group_rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : '';
        $group_rank_priority = $user_color['group_rank_priority'];
    }
    // End: Simple Colored Usergroups MOD v2

#
#-----[ FIND ]------------------------------------------
#
	else if ( $postrow[$i]['user_rank'] )
#
#-----[ REPLACE WITH ]------------------------------------------
#
    // Edited: Simple Colored Usergroups MOD v2
	else if ( $postrow[$i]['user_rank'] && !$group_rank_priority)
    // End: Simple Colored Usergroups MOD v2
#
#-----[ FIND ]------------------------------------------
#
		for($j = 0; $j < count($ranksrow); $j++)
		{
			if ( $postrow[$i]['user_posts'] >= $ranksrow[$j]['rank_min'] && !$ranksrow[$j]['rank_special'] )
			{
				$poster_rank = $ranksrow[$j]['rank_title'];
				$rank_image = ( $ranksrow[$j]['rank_image'] ) ? '<img src="' . $ranksrow[$j]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : '';
			}
		}
#
#-----[ BEFORE, ADD ]------------------------------------------
#
        // Start: Simple Colored Usergroups MOD v2
        if (!isset($group_rank_priority))
        {
        // End: Simple Colored Usergroups MOD v2
#
#-----[ AFTER, ADD ]------------------------------------------
#
        // Start: Simple Colored Usergroups MOD v2
        }
        // End: Simple Colored Usergroups MOD v2
#
#-----[ FIND ]------------------------------------------
#
	//
	// Handle anon users posting with usernames
	//
#
#-----[ BEFORE, ADD ]------------------------------------------
#
        // Start: Simple Colored Usergroups MOD v2
       unset($group_rank_priority);
        // End: Simple Colored Usergroups MOD v2

#
#-----[ FIND ]------------------------------------------
#
	if ( $poster_id != ANONYMOUS )
	{
		$temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$poster_id");
#
#-----[ AFTER, ADD ]------------------------------------------
#
        // Start: Simple Colored Usergroups MOD v2
		$style_color = ($user_color['group_color']) ? ' style="font-weight:bold;color: #' . $user_color['group_color'] . '"' : '';
        $poster_url = '<a href="' . $temp_url . '" ' . $style_color . ' title="' . $lang['Read_profile'] . '">' . $poster . '</a>';
        // End: Simple Colored Usergroups MOD v2
#
#-----[ FIND ]------------------------------------------
#
		$profile_img = '';
		$profile = '';
#
#-----[ BEFORE, ADD ]------------------------------------------
#
        // Start: Simple Colored Usergroups MOD v2
        $poster_url = '';
        // End: Simple Colored Usergroups MOD v2
#
#-----[ FIND ]------------------------------------------
#
		'POSTER_NAME' => $poster,
#
#-----[ REPLACE WITH ]------------------------------------------
#
        // Edit: Simple Colored Usergroups MOD v2
		'POSTER_NAME' => ($poster_url)? $poster_url : $poster,
        // End: Simple Colored Usergroups MOD v2
#
#-----[ OPEN ]------------------------------------------
#
admin/admin_groups.php

#
#-----[ FIND ]------------------------------------------
#
		$group_moderator = $row['username'];
	}
	else
	{
		$group_moderator = '';
	}
#
#-----[ AFTER, ADD ]------------------------------------------
#
    // Start: Simple Colored Usergroups MOD v2
    
	// Get the ranks list
    // routine grabbed from admin_users.php ;)
    
    $sql = "SELECT * FROM " . RANKS_TABLE . "
        WHERE rank_special = 1
        ORDER BY rank_title";

    if ( !($result = $db->sql_query($sql)) )
    {
        message_die(GENERAL_ERROR, 'Could not obtain ranks data', '', __LINE__, __FILE__, $sql);
    }

    $rank_select_box = '<select name="group_rank"><option value="0">' . $lang['No_assigned_rank'] . '</option>';
    while( $row = $db->sql_fetchrow($result) )
    {
        $rank = $row['rank_title'];
        $rank_id = $row['rank_id'];
        
        $selected = ( $group_info['group_rank'] == $rank_id ) ? ' selected="selected"' : '';
        $rank_select_box .= '<option value="' . $rank_id . '"' . $selected . '>' . $rank . '</option>';
    }
    $rank_select_box .= '</select>';
    
    
	// 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"' : '',
			));
		}
	}
    // End: Simple Colored Usergroups MOD v2
#
#-----[ FIND ]------------------------------------------
#
'GROUP_MODERATOR' => $group_moderator,

#
#-----[ AFTER, ADD ]------------------------------------------
#
        // Start: Simple Colored Usergroups MOD v2
        'RANK_SELECT_BOX' => $rank_select_box,
        'S_SELECT_RANK_PRIORITY' => ( $group_info['group_rank_priority'] ) ? 'checked="checked"' : '',
        'L_SELECT_RANK' => $lang['Rank_title'],
        'L_SELECT_RANK_PRIORITY' => $lang['Select_rank_priority'],
        'L_SELECT_RANK_PRIORITY_CHECK' => $lang['Select_rank_priority_check'],

		'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"' : '',
        // End: Simple Colored Usergroups MOD v2
#
#-----[ FIND ]------------------------------------------
#
		//
		// Delete Group
		//

#
#-----[ BEFORE, ADD ]------------------------------------------
#
        // Start: Simple Colored Usergroups MOD v2
		$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);
				}
			}
		}
        // End: Simple Colored Usergroups MOD v2

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

#
#-----[ BEFORE, ADD ]------------------------------------------
#
        // Start: Simple Colored Usergroups MOD v2
		$group_rank = ( isset($HTTP_POST_VARS['group_rank']) ) ? intval( $HTTP_POST_VARS['group_rank'] ) : 0;
		$group_rank_priority = ( isset($HTTP_POST_VARS['group_rank_priority']) ) ? 1 : 0;
		$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;
        // Start: Simple Colored Usergroups MOD v2

#
#-----[ 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 ]------------------------------------------
#
                    // Start: Simple Colored Usergroups MOD v2
					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);
						}
					}
                    // End: Simple Colored Usergroups MOD v2

#
#-----[ 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', group_rank = '$group_rank', group_rank_priority = '$group_rank_priority'
#
#-----[ 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, group_rank, group_rank_priority

#
#-----[ 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', '$group_rank', '$group_rank_priority'
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/admin/group_edit_body.tpl

#
#-----[ FIND ]------------------------------------------
#
	<!-- END group_edit -->

#
#-----[ AFTER, ADD ]------------------------------------------
#
<!--// Start: Simple Colored Usergroups MOD v2 -->
	<tr> 
	  <th class="thHead" colspan="2">{L_COLOR_GROUPS}</th>
	</tr>
    <tr>
		<td class="row1" width="38%"><span class="gen">{L_SELECT_RANK}</span></td>
		<td class="row2" width="62%">{RANK_SELECT_BOX}</td>
	</tr>
	<tr> 
	  <td class="row1" width="38%"><span class="gen">{L_SELECT_RANK_PRIORITY}:</span></td>
	  <td class="row2" width="62%"> 
		<input type="checkbox" name="group_rank_priority" value="1" {S_SELECT_RANK_PRIORITY} /> {L_SELECT_RANK_PRIORITY_CHECK}
	  </td> 
	</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>
<!--// End: Simple Colored Usergroups MOD v2 -->

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


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

#
#-----[ AFTER, ADD ]------------------------------------------
#
        // Start: Simple Colored Usergroups MOD v2
		$group_priority = ( isset($HTTP_POST_VARS['group_priority']) ) ? intval($HTTP_POST_VARS['group_priority']) : 0;

		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"><option value="">' . $lang['Group_priority_select'] . '</option>' . $group_values . '</select>';
			$template->assign_block_vars('switch_color_groups', array());
		}
		else
		{
			$group_priority = 0;
		}
        // End: Simple Colored Usergroups MOD v2

#
#-----[ FIND ]------------------------------------------
#
				SET " . $username_sql . $passwd_sql
#
#-----[ IN-LINE FIND ]------------------------------------------
#
user_timezone = $user_timezone, 
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
group_priority = '$group_priority', 
#
#-----[ FIND ]------------------------------------------
#
			'DATE_FORMAT' => $user_dateformat,
#
#-----[ BEFORE, ADD ]------------------------------------------
#
            // Start: Simple Colored Usergroups MOD v2
            'GROUP_PRIORITY_SELECT' => $group_drop_down,
            // End: Simple Colored Usergroups MOD v2

#
#-----[ FIND ]------------------------------------------
#
			'L_DATE_FORMAT' => $lang['Date_format'],
#
#-----[ BEFORE, ADD ]------------------------------------------
#
            // Start: Simple Colored Usergroups MOD v2
			'L_GROUP_PRIORITY' => $lang['Group_priority'],
            // End: Simple Colored Usergroups MOD v2

#
#-----[ 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 -->
    
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_register.php

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

#
#-----[ AFTER, ADD ]------------------------------------------
#
    // Start: Simple Colored Usergroups MOD v2
    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;
            }
        }
    }
   // End: Simple Colored Usergroups MOD v2

#
#-----[ 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 ]------------------------------------------
#
    // Start: Simple Colored Usergroups MOD v2
	$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"><option value="">' . $lang['Group_priority_select'] . '</option>' . $group_values . '</select>';
		$template->assign_block_vars('switch_color_groups', array());
	}
	else
	{
		$group_priority = 0;
	}
    // End: Simple Colored Usergroups MOD v2
	
#
#-----[ FIND ]------------------------------------------
#
		'DATE_FORMAT' => $user_dateformat,
#
#-----[ BEFORE, ADD ]------------------------------------------
#
        // Start: Simple Colored Usergroups MOD v2
		'GROUP_PRIORITY_SELECT' => $group_drop_down,
        // End: Simple Colored Usergroups MOD v2
#
#-----[ FIND ]------------------------------------------
#
		'L_DATE_FORMAT' => $lang['Date_format'],
#
#-----[ BEFORE, ADD ]------------------------------------------
#
        // Start: Simple Colored Usergroups MOD v2
		'L_GROUP_PRIORITY' => $lang['Group_priority'],
        // End: Simple Colored Usergroups MOD v2
#
#-----[ 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 ]------------------------------------------
#
language/lang_english/lang_main.php

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

#
#-----[ BEFORE, ADD ]------------------------------------------
#
// Start: Simple Colored Usergroups MOD v2
$lang['Group_priority'] = 'User Group priority';
$lang['Group_priority_select'] = 'Select a group...';
$lang['Not_in_group'] = 'You are not in any user groups';
$lang['color_groups_legend'] = 'Legend';
// End: Simple Colored Usergroups MOD v2

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

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

#
#-----[ BEFORE, ADD ]------------------------------------------
#
// Start: Simple Colored Usergroups MOD v2
$lang['Select_rank_priority'] = "Rank priority";
$lang['Select_rank_priority_check'] = "Override user's special rank";
$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';
// End: Simple Colored Usergroups MOD v2

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
DJ Ornsman - Back To 93
Tuesday 9-11pm GMT on Stress Factor

http://www.stressfactor.co.uk

User avatar
zero061099
Registered User
Posts: 328
Joined: Wed Jun 13, 2007 1:19 am

Re: Simple Colored Usergroups

Post by zero061099 »

ok this is what I keep getting...I have read thru all these topics and found no fix. I am extremely familiar with php code and phpbb and I have installed this mod to the "T"

This shows up at the top of my AdminCP> User Management Page:

Code: Select all

Warning: Invalid argument supplied for foreach() in \*****\********\phpbb\admin\admin_users.php on line 762
heres the code its giving me a error about. (Line 762 in above said file)

Code: Select all

foreach($color_groups['groupdata'] AS $color_group)
Is there a fix for this?

Thanks

User avatar
zero061099
Registered User
Posts: 328
Joined: Wed Jun 13, 2007 1:19 am

Re: Simple Colored Usergroups

Post by zero061099 »

ok I am pissed! I cannot get this to work so I want to uninstall. I have remnoved all edits BUT how do you reverse the SQL alter changes?

Any help would be appreciated thanks

tr5714
Registered User
Posts: 2
Joined: Wed Oct 22, 2008 10:30 pm

Re: Simple Colored Usergroups

Post by tr5714 »

I have a question regarding this mod. I've installed it per instructions and it does work, I see all the settings and there is group priority in the profile / user administration panel. However, if I've got someone in more than one user group, it sets their color back to the default white color instead of the color I chose for that group. And in one particular member's profile, I cannot switch over the group priority from one to the other, it's defaulting back to the one I'm trying to change it from each time.

Or if I have them in two groups, in this instance ' Regional Rep, and Member ', and their priority is set to ' Member ' and I delete them out of Member, it'll flip them back to white instead of the Green color that Regional Rep is set to. Does anyone have any idea what's causing this?

MrN1c39uy
Registered User
Posts: 17
Joined: Thu Nov 20, 2008 4:35 pm

Re: Simple Colored Usergroups

Post by MrN1c39uy »

I just installed this MOD and after I finished everything and tried to visit my site, this is what I get:
Could not get group data from database

DEBUG MODE

SQL Error : 1054 Unknown column 'g.group_colors' in 'field list'

SELECT g.group_name, g.group_colors, ug.group_id, u.username, u.user_id, u.group_priority FROM phpbb_groups g, phpbb_user_group ug, phpbb_users 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 AND g.group_type <> 2 ORDER BY g.group_order, g.group_name

Line : 965
File : functions.php
--------------------
Also I had a problem finding the text it told me to find in this file:
#-----[ 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 -->
I exchanged subsilver for my current style which is AcidTechTiger, I am assuming this is what I was suppose to do. Well anyways, I just skipped that step because the text was not in there.

tatsukun
Registered User
Posts: 4
Joined: Tue Dec 16, 2008 3:21 am

Re: Simple Colored Usergroups

Post by tatsukun »

Code: Select all

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

# 
#-----[ FIND ]------------------------------------------
#
	$s_hidden_fields .= '';

	$template->assign_vars(array(

#
#-----[ BEFORE, ADD ]------------------------------------------
#
	$style_color = ($user_color = color_groups_user($user_id)) ? ' style="font-weight:bold;color: #' . $user_color . '"' : '';
Returns the error:

Code: Select all

Critical Error

FIND FAILED: In file [groupcp.php] could not find:

$s_hidden_fields .= ''; 
$template->assign_vars(array( 

MOD script line #323 :: FAQ :: Report
Nevermind figured it out. Removed it from the mod file and went in to search for it manually and found this code:

Code: Select all

	$s_hidden_fields .= '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />';

	$template->assign_vars(array(
And added the necessary line right before it.

rapidsaid
Registered User
Posts: 37
Joined: Sat Apr 05, 2008 3:08 pm

Re: Simple Colored Usergroups

Post by rapidsaid »

hello, how to change link directly to memberlist? em something like this..

Image

TO

Image

if enter the link, its only showing list admin username in memberlist site..not in groupcp page...

Post Reply

Return to “[2.0.x] MOD Database Releases”