Firefox PHP

help request for coloured usernames

Posted by gelbeseiten 
help request for coloured usernames
October 15, 2013 06:59AM
Hello,

I hope I am posting in the correct forum.
The situation:
I got hands on a little mod which allows the users to set a custom colour for their usernames at login. This mode is working with Phorum 5.1 branch. Unfortunately the author is not known to me.

The users would like to have this feature in the upgraded version of 5.2.19 as well. I am a bit at a loss here, as I have VERY little php knowlegde. I have managed to get the search function for 5.2 working but I am not able to get the statements following the search working.

If there is someone willing and interested to help me, how would we go from here ?

Help would be very appreciated. Thank you in advance.
Re: help request for coloured usernames
October 17, 2013 04:29AM
I would do it with a template hack. I would create a custom profile field in the Admin panel called "color" and then on the registration.tpl form within the <form> and </form> tags add this...

Language: PHP
Color?: <input type="text" name="color" size="30" value="" />

... and then on the read.tpl add this....

Language: PHP
{IF MESSAGES->user->color} <FONT COLOR={MESSAGES->user->color}> {MESSAGES->author} </FONT> {ELSE} {MESSAGES->author} {/IF}


Robert Angle
Phorum lover, nothing more.
Ruminations
Re: help request for coloured usernames
October 20, 2013 04:25PM
sorry, I am a bit late here. Thank you for the tip. I will try that and see what happens.

One question, Robert

in the first code sample the "Color?:" for what stands this ?

Could you explain it to me ?
Thank you.
Re: help request for coloured usernames
October 20, 2013 10:34PM
"Color?:" is what shows onscreen to the user so they know what is being asked to put into the input box.
Re: help request for coloured usernames
October 21, 2013 03:06AM
I must doing something wrong as the username is not shown in the color which is entered into the database to the correct userid.
Steps I did.

Created the custom-user-field in the admin area, named color
Added the field to the register.tpl
changed the read.tpl and added the code from above around line 34. It looks like this

<td width="100%">
                <div class="message-author icon-user">
                {IF MESSAGES->URL->PROFILE}<a href="{MESSAGES->URL->PROFILE}">{/IF}
		{IF MESSAGES->user->color}<FONT COLOR="{MESSAGES->user->color}"> {MESSAGES->author} </FONT>
                     {ELSE}{MESSAGES->author}{/IF}{IF MESSAGES->URL->PROFILE}</a>{/IF}
                            {IF MESSAGES->URL->PM}<small>[ <a href="{MESSAGES->URL->PM}">{LANG->PrivateReply}</a> ]</small>{/IF}
                        </div>

After this I created a new user and a new post.

One thought: as the username is a link, is the custom_user_field overwritten with the link_color setting from the settings.tpl?

Or did I place it at the wrong spot, as all this is pretty new to me ?
Re: help request for coloured usernames
October 25, 2013 04:22PM
Quote
gelbeseiten
One thought: as the username is a link, is the custom_user_field overwritten with the link_color setting from the settings.tpl?

Or did I place it at the wrong spot, as all this is pretty new to me ?

Sorry for the delay. My community uses commercial/paid software now, but I keep coming back here because I had a strong attachment to Phorum. I would have to find the time to play with this myself to make sure I'm wrapping my head around it right and not overlooking anything either.

Yes, being a link, the link color will display. Perhaps try this instead....

Language: PHP
<div class="message-author icon-user">   <!-- Determine whether there is a custom color -->   {IF MESSAGES->user->color} <BR> <FONT COLOR="{MESSAGES->user->color}"> {MESSAGES->author} </FONT> {ELSE} <BR> {MESSAGES->author} {/IF}   <!-- Should we display a link to the user profile? -->   {IF MESSAGES->URL->PROFILE} <BR> <small>[ <a href="{MESSAGES->URL->PROFILE}"> Profile </a> ]</small> {/IF}   <!-- Should we display a link to directly private message the user? -->   {IF MESSAGES->URL->PM} <BR> <small>[ <a href="{MESSAGES->URL->PM}">{LANG->PrivateReply}</a> ]</small> {/IF}   </div>

This way, the link color doesn't override the custom color, and a separate link to provided for the profile just like one for the private message. The <BR> tags are simple line breaks.


Robert Angle
Phorum lover, nothing more.
Ruminations



Edited 1 time(s). Last edit at 10/25/2013 04:25PM by Robert Angle.
Sorry, only registered users may post in this forum.

Click here to login