MyBB Community Forums

Full Version: User defined username color
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi, I'm new here, and I came here with a problem I'm having, obviously.

I want all forum members to be able to choose in which color their username will be displayed in posts.

How I want this to work:

I've created a custom profile field in which members can specify the color in which they want their username to appear in posts.

Next, I should add some code to the post bit template that will allow it to read this profile field and make the appropriate changes accordingly. But what?

I managed to do this with the color of the messages, so users can specify in which color their messages/posts are displayed in.

But how to do it for the usernames in posts? Confused

Can anyone on here help me, plz? Smile

Is this possible at all?

Excuse me if this is posted in the wrong section.
I don't think I've seen this be done.. but i suppose it's possible. It will have to be variable will it not?
(2011-12-18, 08:19 PM)roggers Wrote: [ -> ]I don't think I've seen this be done.. but i suppose it's possible. It will have to be variable will it not?

Yeah, whatever color a member puts in the 'username color' box on their profile, their username should be displayed in that color in posts.
Try with this (i didn't tried this yet):

Open postbit or postbit_classic template and find

<strong><span class="largetext">{$post['profilelink']}</span></strong>


In span tag add

Quote:style="color:{$post['fidX']};"

so it will look like

<strong><span class="largetext" style="color:{$post['fidX']};">{$post['profilelink']}</span></strong>

fidX is id of your custom field.

Edit: i'll run few additional test on localhost to see if this method is working.
Thanks for your reply. This is exactly what I tried though, but it doesn't work. As long as the forum sees {$post['profilelink']} as a part of a:link, it won't work.
Works without any problems only if you don't have username styled by usergroup (in Users & Groups -> Groups -> <your usergroup> username Style field must only contain {username} (no tags around username).


Screenshoot: http://i.imgur.com/GMNN1.png

Instead of {$post['profilelink']} i'm using {$post['username_formatted']}.

if you are willing to make temp admin acc i can take look at that and fix it (if you want you can send me details on pm).
When I use {$post['username_formatted']} and save the template, it changes it to just {}.
Try with {$post['username']}
Johnny so far it works with {$post['username']} , thanks a lot Smile

I don't really have a forum yet, well not a public one at least, I just made one to practise my theme designing and HTML. I'm just generally very interested in forums, and specially MyBB. I'm just a beginner though when it comes to HTML.
I should have seen this coming, I can't click on the usernames anymore, how can I make them lead to the member's profile again without losing this color feature?
(2011-12-19, 12:26 AM)darkhorus Wrote: [ -> ]I should have seen this coming, I can't click on the usernames anymore, how can I make them lead to the member's profile again without losing this color feature?


Quote:<a style="color:{$post['fidX']};" href="{$mybb->settings['bburl']}/member.php?action=profile&amp;uid={$post['uid']}">{$post['username']}</a>
Pages: 1 2