Individual Colors for users

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • voter
    Senior Member
    • Jan 2007
    • 106

    Individual Colors for users

    Some of my users don't like the Color I assigned to the group they are member of.

    Is there a simple way to put some Replacement Variables or IF conditions for whole system, so that in case $usedid is 23 or 453 or 843 or so on, the color defined in Username HTML Markup in Usergroup do not work or be replaced with a defined color?

    Thanks in advance
    http://viparmenia.net/
    http://viparmenia.co/
    http://viparmenia.com/
  • peterska2
    Senior Member
    • Oct 2003
    • 8869
    • 3.7.x

    #2
    The best way to go about this, is to use a user profile field to determine the username color and to use user ranks to determine their usergroup unless you are using some easy markup such as bold for moderators and bold+italic for administrators only.

    This does, however, require editing of quite a number of templates to display the user name colors throughout the site, and for some areas such as online users on the forum home it is not possible to show the usernames in the colors they have picked without using additional plugins.

    Comment

    • voter
      Senior Member
      • Jan 2007
      • 106

      #3
      Originally posted by Kerry-Anne
      The best way to go about this, is to use a user profile field to determine the username color and to use user ranks to determine their usergroup unless you are using some easy markup such as bold for moderators and bold+italic for administrators only.

      This does, however, require editing of quite a number of templates to display the user name colors throughout the site, and for some areas such as online users on the forum home it is not possible to show the usernames in the colors they have picked without using additional plugins.
      I was hoping that you or anybody will say "it is easy", but seems my thoughts, that I must go through a lot of templates with if conditions, confirmed.

      However, would you agree to put a code to be added and list of templates, that must be changed if I decide to start self-torture and put everywhere the condition depends on Customized user profile field?

      Or may be you use my suggestion for future releases http://www.vbulletin.com/forum/showthread.php?t=216409, then I can forward this info to my users and keep them waiting for new release.
      http://viparmenia.net/
      http://viparmenia.co/
      http://viparmenia.com/

      Comment

      • peterska2
        Senior Member
        • Oct 2003
        • 8869
        • 3.7.x

        #4
        Firstly you need to create a new user profile field
        AdminCP > User Profile Fields > Add New User Profile Field
        Select Single line text box (this allows users to input their own value)

        Now set the profile field up using the following information
        Title: User Name Color
        Description: Add a 6 character hex color code here to display your username in color (you can link to a hex color chart here if you wish)
        Default Value: leave this blank
        Max length of user input: 6
        Field length: 6
        Display Order: leave as default
        Field Required: No
        Field Editable by User: Yes
        Private Field: No
        Searchable on Members list: No
        Show On members list: No
        Regular Expression: leave blank
        Which page displays this option: Edit Profile

        When you save this, make a note of the id that it is given which will be field5 or similar. The number given to it is needed in the next steps.

        Moving on to the template edits
        AdminCP > Styles & Templates > Style Manager > Edit Templates
        In your postbit (or postbit_legacy) template

        FIND
        Code:
        $post[musername]
        Replace with
        Code:
        <if condition="$post[fieldx]"><span style="color: #$post[fieldx]">$post[musername]</span><else />$post[musername]</if>
        In this code there are two instances of fieldx. You need to replace the x so that this reads as the same as the profile field you created above.

        In the memberinfo template

        FIND
        Code:
        $userinfo[musername]
        and replace with
        Code:
        <if condition="$userinfo[fieldx]"><span style="color: #$userinfo[fieldx]">$userinfo[musername]</span><else />$userinfo[musername]</if>
        Again there are two instances of fieldx which require updating to replace the x with the number of your profile field.

        This can be expanded to work on the members list and who's online and other parts of the site, but these are the two most commonly viewed ones.

        In order for this to work, you must not have any color html markup specified for your usergroups. You may however use bold and italic markups.

        Comment

        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
        Working...