1 (edited by Reines 2004-10-10 22:02)

Topic: Colouring usernames

This is my first mod i've posted, and the mod generator is down, so please excuse the fact that it isn't in proper format, also it's just a tiny thing.

##
##        Mod title:  Colouring usernames
##
##      Mod version:  1.0
##   Works on PunBB:  1.0 RC2, 1.0
##     Release date:  2004-10-10
##           Author:  Reines (reines@gmail.com)
##
##      Description:  This mod will make moderator and admin usernames show
##                    red in both the online list and topics.
##
##   Affected files:  index.php
##                    viewtopic.php
##                    style/*.css
##
##       Affects DB:  No
##
##            Notes:  Nothing hard, just changes some colours.
##
##       DISCLAIMER:  Please note that "mods" are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##
##

Instructions here.

Re: Colouring usernames

You have the info of how the readmes are made in the Mod Development Kit found on the download page

Mod Development Kit

The MDK is a small package aimed at those who want to develop modifications for PunBB. It contains a textfile with instructions, a template for the readme file (all mods have a readme.txt) and a template for a mod installation script.

    * MDK for PunBB 1.1.*

For more information about PunBB modding, visit the PunBB Resource.

The mod generator only helps to put together the readme.txt smile

3

Re: Colouring usernames

Very good idea Reines.. I love it!

Re: Colouring usernames

Frank H wrote:

You have the info of how the readmes are made in the Mod Development Kit found on the download page

Mod Development Kit

The MDK is a small package aimed at those who want to develop modifications for PunBB. It contains a textfile with instructions, a template for the readme file (all mods have a readme.txt) and a template for a mod installation script.

    * MDK for PunBB 1.1.*

For more information about PunBB modding, visit the PunBB Resource.

The mod generator only helps to put together the readme.txt smile

thanks tongue

5

Re: Colouring usernames

Tnx.

6 (edited by mark36ph 2004-11-19 22:14)

Re: Colouring usernames

can i just ask, how do i make the mod color different to the admin?

eg...   Admin    Moderator

7

Re: Colouring usernames

on the step

#
#---------[ 5. REPLACE WITH ]---------------------------------------------------
#

    while ($cur_user_online = $db->fetch_assoc($result))
    {
        if($cur_user_online['status'] > PUN_USER)
            $users[] = '<a class="punadmod" href="profile.php?id='.$cur_user_online['user_id'].'">'.pun_htmlspecialchars($cur_user_online['ident']).'</a>';
        else
            $users[] = '<a href="profile.php?id='.$cur_user_online['user_id'].'">'.pun_htmlspecialchars($cur_user_online['ident']).'</a>';        
    }

read thru it... where it says

if($cur_user_online['status'] > PUN_USER)

it mean if the user is greater than a user, change the color to punadmod. punadmod is the thing u put in the stylesheet. its the same for step 10 too

*removed by Rickard*
^ 1337 php and mySQL sig
Like annoying people with visual basic? http://www.annoyingvb.com <-- the home for virus/spammers/trojans. ect source code!

Re: Colouring usernames

thx works great!
but i still don't understand how to make the colour for an admin differ from the colour a moderator... roll

9

Re: Colouring usernames

lol thats wot i asked spaz last night.
he said if u dont know that then you can not do it!!!
i will find out though!

Re: Colouring usernames

yeah well i'm a beginner with php, go figure big_smile:D:D
btw: if you found it out, plz explain to me in newbie language wink

11

Re: Colouring usernames

i'm a noobie aswell m8. i will ask spaz to explain in nooby language tongue

Re: Colouring usernames

big_smile that would be nice thx!

13

Re: Colouring usernames

Yes, that would be nice ... big_smile

14 (edited by Connorhd 2005-01-02 11:42)

Re: Colouring usernames

#
#---------[ 1. OPEN ]---------------------------------------------------------
#

index.php

#
#---------[ 2. DELETE (line: 174) ]-------------------------------------------
#

$num_guests = 0;

#
#---------[ 2. FIND (line: 175) ]---------------------------------------------
#

    $result = $db->query('SELECT user_id, ident FROM '.$db->prefix.'online ORDER BY ident') or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());


#
#---------[ 3. REPLACE WITH ]-------------------------------------------------
#

    $result = $db->query('SELECT o.user_id, o.ident, u.status FROM '.$db->prefix.'online AS o INNER JOIN '.$db->prefix.'users AS u ON u.id=o.user_id WHERE o.user_id>0 ORDER BY ident') or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());


#
#---------[ 4. FIND (line: 177) ]---------------------------------------------
#

    while ($cur_user_online = $db->fetch_assoc($result))
    {
        if ($cur_user_online['user_id'] > 0)
            $users[] = '<a href="profile.php?id='.$cur_user_online['user_id'].'">'.pun_htmlspecialchars($cur_user_online['ident']).'</a>';
        else
            ++$num_guests;
    }


#
#---------[ 5. REPLACE WITH ]---------------------------------------------------
#

    while ($cur_user_online = $db->fetch_assoc($result))
    {
        if($cur_user_online['status'] > PUN_MOD)
            $users[] = '<a class="punadmin" href="profile.php?id='.$cur_user_online['user_id'].'">'.pun_htmlspecialchars($cur_user_online['ident']).'</a>';
        elseif($cur_user_online['status'] > PUN_USER)
            $users[] = '<a class="punmod" href="profile.php?id='.$cur_user_online['user_id'].'">'.pun_htmlspecialchars($cur_user_online['ident']).'</a>';
        else
            $users[] = '<a href="profile.php?id='.$cur_user_online['user_id'].'">'.pun_htmlspecialchars($cur_user_online['ident']).'</a>';        
    }

#
#---------[ 6. FIND (line: 185) ]---------------------------------------------
#

$num_users = count($users);

#
#---------[ 7. AFTER, ADD ]---------------------------------------------------
#

    $result = $db->query('SELECT COUNT(ident) FROM '.$db->prefix.'online WHERE user_id=0') or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());
    $num_guests = $db->result($result);

#
#---------[ 8. OPEN ]---------------------------------------------------------
#

viewtopic.php

#
#---------[ 9. FIND (line: 227) ]---------------------------------------------
#

        if (isset($online_list) && in_array($cur_post['poster_id'], $online_list))
            $info = '<span class="punheadline"><a href="profile.php?id='.$cur_post['poster_id'].'"><u>'.pun_htmlspecialchars($cur_post['poster']).'</u></a></span>';
        else
            $info = '<span class="punheadline"><a href="profile.php?id='.$cur_post['poster_id'].'">'.pun_htmlspecialchars($cur_post['poster']).'</a></span>';

#
#---------[ 10. REPLACE WITH ]------------------------------------------------
#

        switch($cur_post['status'])
        {
            case 2:
                if (isset($online_list) && in_array($cur_post['poster_id'], $online_list))
                    $info = '<a class="punadmin" href="profile.php?id='.$cur_post['poster_id'].'"><u>'.pun_htmlspecialchars($cur_post['poster']).'</u></a>';
                else
                    $info = '<a class="punadmin" href="profile.php?id='.$cur_post['poster_id'].'">'.pun_htmlspecialchars($cur_post['poster']).'</a>';
            break;
            case 1:
                if (isset($online_list) && in_array($cur_post['poster_id'], $online_list))
                    $info = '<a class="punmod" href="profile.php?id='.$cur_post['poster_id'].'"><u>'.pun_htmlspecialchars($cur_post['poster']).'</u></a>';
                else
                    $info = '<a class="punmod" href="profile.php?id='.$cur_post['poster_id'].'">'.pun_htmlspecialchars($cur_post['poster']).'</a>';
            break;
            default:
                if (isset($online_list) && in_array($cur_post['poster_id'], $online_list))
                    $info = '<span class="punheadline"><a href="profile.php?id='.$cur_post['poster_id'].'"><u>'.pun_htmlspecialchars($cur_post['poster']).'</u></a></span>';
                else
                    $info = '<span class="punheadline"><a href="profile.php?id='.$cur_post['poster_id'].'">'.pun_htmlspecialchars($cur_post['poster']).'</a></span>';
        }


#
#---------[ 11. OPEN ]--------------------------------------------------------
#

Each style sheet, one at a time if easier.

#
#---------[ 12. ADD TO THE END ]----------------------------------------------
#

A:link.punmod, A:visited.punmod , A:hover.punmod {
    color: #FF0000;
    font-size: 12px;
    font-weight: bold
}
A:link.punadmin, A:visited.punadmin , A:hover.punadmin {
    color: #0000FF;
    font-size: 12px;
    font-weight: bold
}

#
#---------[ 13. SAVE/UPLOAD ]-------------------------------------------------
#

different colours for admins and mods

15

Re: Colouring usernames

It works nice big_smile

Thank you ...

Re: Colouring usernames

hello nice mod . havent try it yet tho.. board is to new to crash ... hi hi ... but was wondering anyway to make a choice color list in admin cp .. so u can color all the names diff maybe if wanted to.... like purple for new users. red for admin . blue for mods. so on n so on .. that would be nice to have .....

we cant all have what we want but with a little help from friends we can sure as hell try lol

Re: Colouring usernames

well the idea is its per style so you add the different colours in the style

18 (edited by darkside 2004-12-28 20:51)

Re: Colouring usernames

nice edition connorhd smile

the mod of reines worked fine for me,
but now i changed it to your version cause that seems even better!
but it throws the users back and forth in viewtopic.php
alignment is gone.. normal user are not or partly viewed?
when you view a topic you see the admins avatar double and only part of the users
the users are gone? does it have anything to do with the "elseif" in the code above?

what happend?

[EDIT] i changed it back untill i/we can figure out what is going wrong.

19 (edited by Connorhd 2004-12-29 21:06)

Re: Colouring usernames

edit sorry i just did a new step 10 but i pasted the wrong thing into the post box anyway do this for step 10 and it might work but i don't have time to test it atm

#
#---------[ 10. REPLACE WITH ]------------------------------------------------
#

        switch($cur_post['status'])
        {
            case 2:
                if (isset($online_list) && in_array($cur_post['poster_id'], $online_list))
                    $info = '<a class="punadmin" href="profile.php?id='.$cur_post['poster_id'].'"><u>'.pun_htmlspecialchars($cur_post['poster']).'</u></a>';
                else
                    $info = '<a class="punadmin" href="profile.php?id='.$cur_post['poster_id'].'">'.pun_htmlspecialchars($cur_post['poster']).'</a>';
            break;
            case 1:
                if (isset($online_list) && in_array($cur_post['poster_id'], $online_list))
                    $info = '<a class="punmod" href="profile.php?id='.$cur_post['poster_id'].'"><u>'.pun_htmlspecialchars($cur_post['poster']).'</u></a>';
                else
                    $info = '<a class="punmod" href="profile.php?id='.$cur_post['poster_id'].'">'.pun_htmlspecialchars($cur_post['poster']).'</a>';
            break;
            default:
                if (isset($online_list) && in_array($cur_post['poster_id'], $online_list))
                    $info = '<span class="punheadline"><a href="profile.php?id='.$cur_post['poster_id'].'"><u>'.pun_htmlspecialchars($cur_post['poster']).'</u></a></span>';
                else
                    $info = '<span class="punheadline"><a href="profile.php?id='.$cur_post['poster_id'].'">'.pun_htmlspecialchars($cur_post['poster']).'</a></span>';
        }


#

20

Re: Colouring usernames

Shit i deleted my old hosting and forgot to save the file, so sorry but the link is dead tongue

21

Re: Colouring usernames

woops!

Re: Colouring usernames

thank you connorhd
i'll test it later on! smile

Re: Colouring usernames

well as far as i can see now... it works smile great thx!
i'll wait and see wheter our users wil report something buggie (i think and hope not)

24 (edited by Connorhd 2004-12-31 18:34)

Re: Colouring usernames

well for some unknown reason it seems to have been ignoring the else(if) so the admins would get their profile done twice :S

Re: Colouring usernames

yeah precisely that's what happend when i used the first "step 10"
the second one however works fine! great thx