Welcome, you're not connected. ( Log in - Register )

Ishimaru-Design > Tutorials, ressources and support > phpBB2 > Tutorials & Tips > Add-ons for Simple Colored Usergroups MOD

RSS >  Add-ons for Simple Colored Usergroups MOD
Ishimaru Chiaki #1 20/12/2007 - 00h54

Class : ID Admin
Posts : 1011
Registered on : 12/11/2007
Age : 25
Sex : Female

Offline Mail Www

The "Simple Colored Usergroups" MOD developed by kkroo, and its SCU_global patch are quite popular among phpBB2 admins and it's often used with other MODs.  So several phpBB2 admins might have noticed the usernames aren't colored in blocks or pages added by MOD installations, such as subforums and birthdays.

For this reason, I open this topic in order to propose patches to adapt Simple Colored Usergroups to frequently used MODs.  These addons have been tested on a local phpBB 2.0.22 board.

Here is the list of addons.
[list=1][*] Add-on for Simple Subforums MOD
[*] Add-on for Birthday MOD
[*]Add-on for Watched Topics MOD
[*]Add-on for Admin Userlist MOD[/list:o]

More add-ons might come later, as I do local testing.
Back to my Ubuntu, RIP Hardy, welcome Jaunty !
My portfolio (only available in French for now)
Posted Image
Posted Image
Posted Image
Ishimaru Chiaki #2 20/12/2007 - 00h58

Class : ID Admin
Posts : 1011
Registered on : 12/11/2007
Age : 25
Sex : Female

Offline Mail Www

1- Add-on for Simple Subforums MOD

If you installed this MOD, here are the directions to follow, so the usernames and groups will be colored in the subforums block in viewforum.php

Get your Wordpad/Notepad++ ready !

OPEN

[code:1]viewforum.php[/code:1]

FIND

[code:1]    $subforum_moderators[$row['forum_id']][] = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $row['user_id']) . '">' . $row['username'] . '</a>';[/code:1]

BEFORE, ADD

[code:1]    $mod_color = ($user_color = color_groups_user($row['user_id'])) ? 'style="font-weight:bold;color: #' . $user_color . '" ' : '';[/code:1]

IN LINE, FIND

[code:1]href="[/code:1]

IN LINE, BEFORE, ADD

' . $mod_color . '

FIND

[code:1]    $sql = "SELECT aa.forum_id, g.group_id, g.group_name [/code:1]

IN LINE, FIND

[code:1]g.group_name[/code:1]

IN LINE, AFTER, ADD

[code:1], g.group_colors[/code:1]

FIND

[code:1]        $subforum_moderators[$row['forum_id']][] = '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $row['group_id']) . '">' .     $row['group_name'] . '</a>';[/code:1]

BEFORE, ADD

[code:1]        // unserialize group color
        $row_group_colors = unserialize( $row['group_colors'] );

        // get color for current style
        if ( ! $userdata['session_logged_in'] )
        {
            $group_color = $row_group_colors[ $board_config['default_style'] ];
        }
        else
        {
            $group_color = $row_group_colors[ $userdata['user_style'] ];
        }

        $mod_group_color = ( !empty( $group_color ) ) ? 'style="font-weight:bold;color: #' . $group_color . '" ' : '';[/code:1]

IN LINE, FIND

[code:1]href="[/code:1]

IN LINE, BEFORE, ADD

[code:1]' . $mod_group_color . '[/code:1]

FIND

[code:1]                $last_post .= ( $subforum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($subforum_data[$j]['post_username'] != '' ) ? $subforum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . '='  . $subforum_data[$j]['user_id']) . '">' . $subforum_data[$j]['username'] . '</a> ';[/code:1]

BEFORE, ADD

[code:1]                                $style_color = ($user_color = color_groups_user($subforum_data[$j]['user_id'])) ? 'style="font-weight:bold;color: #' . $user_color . '" ' : '';[/code:1]

IN LINE, FIND

[code:1]href="[/code:1]

IN LINE, BEFORE, ADD

[code:1]' . $style_color . '[/code:1]

SAVE AND CLOSE FILE
Back to my Ubuntu, RIP Hardy, welcome Jaunty !
My portfolio (only available in French for now)
Posted Image
Posted Image
Posted Image
Ishimaru Chiaki #3 20/12/2007 - 01h02

Class : ID Admin
Posts : 1011
Registered on : 12/11/2007
Age : 25
Sex : Female

Offline Mail Www

2- Add-on For Birthday MOD

If you installed the Birthday MOD, here are the directions to follow, so the members who are having a birthday today or shortly will be shown with their group color.

Get your Wordpad/Notepad++ ready !

OPEN

[code:1]index.php[/code:1]

FIND

[code:1]            $color = '';
            if ( $row['user_level'] == ADMIN )
            {
                $color = ' style="color:#' . $theme['fontcolor3'] . '"';
            }
            else if ( $row['user_level'] == MOD )
            {
                $color = ' style="color:#' . $theme['fontcolor2'] . '"';
            }
[/code:1]

REPLACE WITH

[code:1]
            // COLOR GROUPS ADDON FOR BIRTHDAYS
            $color = ($user_color = color_groups_user($row['user_id'])) ? 'style="font-weight:bold;color: #' . $user_color . '" ' : '';
            $username = '<span ' . $color . '>' . $username . '</span>';
            // COLOR GROUPS END
[/code:1]

FIND

[code:1]
            $user_birthdays[] = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $color . '>' . $row['username'] . '</a>' . $age;
[/code:1]

IN LINE, FIND

[code:1]href="[/code:1]

IN LINE, BEFORE, ADD

[code:1]' . $color . '[/code:1]

FIND

[code:1]                $color = '';
                if ( $row['user_level'] == ADMIN )
                {
                    $color = ' style="color:#' . $theme['fontcolor3'] . '"';
                }
                else if ( $row['user_level'] == MOD )
                {
                    $color = ' style="color:#' . $theme['fontcolor2'] . '"';
                }[/code:1]

REPLACE WITH

[code:1]
                // COLOR GROUPS ADDON FOR BIRTHDAYS
                $color = ($user_color = color_groups_user($row['user_id'])) ? 'style="font-weight:bold;color: #' . $user_color . '" ' : '';
                $username = '<span ' . $color . '>' . $username . '</span>';
                // COLOR GROUPS END
[/code:1]

FIND

[code:1]                $upcoming_birthdays[] = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $color . '>' . $row['username'] . '</a>' . $age;[/code:1]

IN LINE, FIND

[code:1]href="[/code:1]

IN LINE, BEFORE, ADD

[code:1]' . $color . '[/code:1]

SAVE AND CLOSE FILE
Back to my Ubuntu, RIP Hardy, welcome Jaunty !
My portfolio (only available in French for now)
Posted Image
Posted Image
Posted Image
Ishimaru Chiaki #4 20/12/2007 - 01h07

Class : ID Admin
Posts : 1011
Registered on : 12/11/2007
Age : 25
Sex : Female

Offline Mail Www

3- Add-on for Watched Topics MOD

If you installed the Watched Topics MOD which adds a page where your members can view a list of topics they watch via a link in the link bar, here are the directions to color the usernames in this page.

Get your Wordpad/Notepad++ ready !

OPEN

[code:1]watched_topics.php[/code:1]

FIND

[code:1]           $last_poster = ($watch_rows[$i]['poster_id'] == ANONYMOUS ) ? ( ($watch_rows[$i]['last_username'] != '' ) ? $watch_rows[$i]['last_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid($phpbb_root_path . "profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . '='  . $watch_rows[$i]['poster_id']) . '">' . $watch_rows[$i]['last_username'] . '</a> ';[/code:1]

BEFORE, ADD

[code:1]        $last_poster_color = ($user_color = color_groups_user($watch_rows[$i]['poster_id'])) ? 'style="font-weight:bold;color: #' . $user_color . '" ' : '';
[/code:1]

IN LINE, FIND

[code:1]href="[/code:1]

IN LINE, BEFORE, ADD

[code:1]' . $last_poster_color . '[/code:1]

FIND

[code:1]     $topic_poster = ($watch_rows[$i]['topic_poster'] == ANONYMOUS ) ? ( ($watch_rows[$i]['author_username'] != '' ) ? $watch_rows[$i]['author_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid($phpbb_root_path . "profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . '='  . $watch_rows[$i]['topic_poster']) . '">' . $watch_rows[$i]['author_username'] . '</a> ';[/code:1]

BEFORE, ADD

[code:1]        $topic_poster_color = ($user_color = color_groups_user($watch_rows[$i]['user_id'])) ? 'style="font-weight:bold;color: #' . $user_color . '" ' : '';[/code:1]

IN LINE, FIND

[code:1]href="[/code:1]

IN LINE, BEFORE, ADD

[code:1]' . $topic_poster_color . '[/code:1]

SAVE AND CLOSE FILE
Back to my Ubuntu, RIP Hardy, welcome Jaunty !
My portfolio (only available in French for now)
Posted Image
Posted Image
Posted Image
Ishimaru Chiaki #5 20/12/2007 - 01h09

Class : ID Admin
Posts : 1011
Registered on : 12/11/2007
Age : 25
Sex : Female

Offline Mail Www

4- Add-on for Admin Userlist MOD

Even if the Admin Userlist MOD is provided with a patch for colored usergroups, this patch isn't compatible with kkroo's Simple Colored Usergroups MOD.

So, if you use kkroo's MOD, follow these directions :

OPEN

[code:1]admin/admin_userlist.php[/code:1]

FIND

[code:1]            $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'] . '"';
            }[/code:1]

REPLACE WITH

[code:1]            // 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[/code:1]

SAVE AND CLOSE FILE
Back to my Ubuntu, RIP Hardy, welcome Jaunty !
My portfolio (only available in French for now)
Posted Image
Posted Image
Posted Image

 >  Fast reply

Message

Ishimaru-Design > Tutorials, ressources and support > phpBB2 > Tutorials & Tips > Add-ons for Simple Colored Usergroups MOD

 >  Stats

1 user(s) connected during the last 10 minutes (0 member(s) and 1 guest(s)).