1 (edited by User33 2008-11-20 20:57)

Topic: User/Group Colors

I'm currently working on an extension that allows users/groups to have different colors.

The only way I have found to do this so far is:

<hook id="fn_forum_link_end">
    global $forum_url;
    if($link==$forum_url['user'])
    {
        //Get user/group color from DB query
        $gen_link .= '" style="color:#'.$color;
    }
</hook>

Issues

  • Could end up doing too many DB queries

  • Some profile links that are not usernames (like Profile link on navbar) get colored

  • Usernames that do not have links generated by forum_link() function do not get colored

If you know another possible way to do this, post it here. Thanks smile

Re: User/Group Colors

Garciat wrote:

Could end up doing too many DB queries

Cache the lists of user_id's for admin/mods/other colored groups.

Garciat wrote:

Some profile links that are not usernames (like Profile link on navbar) get colored
Usernames that do not have links generated by forum_link() function do not get colored

I think the most correct way is not fn_forum_link_end, but to alter the "username" before displaying in many hooks. Though I don't know whether it is really possible :-)

Carpe diem

Re: User/Group Colors

Anatoly wrote:

Cache the lists of user_id's for admin/mods/other colored groups.

I don't really know how the cache works or how to add stuff to the cache.

Re: User/Group Colors

Garciat wrote:

I don't really know how the cache works or how to add stuff to the cache.

Just read the code of include/cache.php.

Carpe diem

5 (edited by User33 2008-11-21 19:15)

Re: User/Group Colors

Anatoly wrote:

Just read the code of include/cache.php.

Ok, now I know how they cache files are made smile Now, how do I get information from them instead of the DB? sad

Edit: Nevermind, I think I know how.

Re: User/Group Colors

Has anyone been able to do this?

Re: User/Group Colors

Did you get any further with this Garciat?
Would be good to see this extension completed. smile

Re: User/Group Colors

Yeah I'd like to see this completed too big_smile