PDA

View Full Version : Custom VIP username color


TC-Jamech
01-03-2015, 03:09 PM
Hi everyone,
So I've searched the forums for some sort of custom vip, but no joy. I managed to get hold of a custom VIP script however what gives anyone within the VIP group to change their user rank colour . How do I go about making this possible for usernames too?

This is the script I used for my usergroup (placed in postbit_legacy):

<if condition="is_member_of($post, 14)">
<div style="width: 125px; height: 24px; background: $post[field9]; margin-top: 1px"><img src="customvip.png" style="margin-top: -1px;" /></div>
</if>

And this is the current username field:
<div id="postmenu_$post[postid]">
<if condition="$show['profile']">
<a class="bigusername" href="member.php?$session[sessionurl]u=$post[userid]">$post[musername]</a>
<script type="text/javascript"> vbmenu_register("postmenu_$post[postid]", true); </script>
<else />
$post[musername]
</if>

ozzy47
01-03-2015, 08:16 PM
You would need to make changes in the memberaction_dropdown template, as that is where the posters username is pulled from.

TC-Jamech
01-03-2015, 10:03 PM
You would need to make changes in the memberaction_dropdown template, as that is where the posters username is pulled from.

I tried looking for that template, or phrase, none found.. bare in mind this is vb3.

ForceHSS
01-03-2015, 10:35 PM
in usergroup manager edit your vip group and in the Username HTML Markup
first box put
<span style="color:yellow;font-weight:bold;text-shadow: 1px 1px 10px yellow;">2nd box put
</span>change the yellow to the colour you want

not sure if this is the type of thing you are looking for

TC-Jamech
01-04-2015, 12:39 AM
in usergroup manager edit your vip group and in the Username HTML Markup
first box put
<span style="color:yellow;font-weight:bold;text-shadow: 1px 1px 10px yellow;">2nd box put
</span>change the yellow to the colour you want

not sure if this is the type of thing you are looking for

No it isn't.

ozzy47
01-04-2015, 12:42 AM
I tried looking for that template, or phrase, none found.. bare in mind this is vb3.

Oooops, in that case, you need to mess around with the following, in the postbit or postbit_legacy template.

<a class="bigusername" href="member.php?$session[sessionurl]u=$post[userid]">$post[musername]</a>

TC-Jamech
01-04-2015, 12:44 AM
Update;

I've managed to get the username colour working on postbit, however, it isn't on the forum home.. Any idea?

Postbit code:
<if condition="$show['profile']">
<a class="bigusername" href="member.php?$session[sessionurl]u=$post[userid]" <if condition="is_member_of($post, 27)">style="color:$post[field9]"</if>>$post[musername]</a>
<script type="text/javascript"> vbmenu_register("postmenu_$post[postid]", true); </script>
<else />
$post[musername]
</if>

forumhome template:
<tbody id="collapseobj_forumhome_activeusers" style="$vbcollapse[collapseobj_forumhome_activeusers]">
<tr>
<td class="alt2"><a href="online.php$session[sessionurl_q]"><img src="$stylevar[imgdir_misc]/whos_online.gif" alt="$vbphrase[view_whos_online]" border="0" /></a></td>
<td class="alt1" width="100%">
<div class="smallfont">
<div style="white-space: nowrap"><phrase 1="$recordusers" 2="$recorddate" 3="$recordtime">$vbphrase[most_users_ever_online_was_x_y_at_z]</phrase></div>
<div>$activeusers</div>
</div>
</td></if>
</tr>
</tbody>
<!-- end logged-in users -->

Simon Lloyd
01-04-2015, 01:16 AM
They are Usergroup colours that show in the forumhome, the usergroup colours are set in the usergroup manager for each usergroup.

ozzy47
01-04-2015, 01:17 AM
Yeah I don't think you can do that easily, as the $post variable is only available in the postbit template.

TC-Jamech
01-04-2015, 01:32 AM
They are Usergroup colours that show in the forumhome, the usergroup colours are set in the usergroup manager for each usergroup.

Again, I want it so that it's customized to what the user has set it to through the profile field. Not to what I've set it to through the usergroup manager.

ozzy47
01-04-2015, 01:34 AM
Actually you want to use $bbuserinfo['fieldX'] instead of $post[fieldX] for forumhome.

kh99
01-04-2015, 02:43 AM
Using $bbuserinfo['fieldX'] will use your fieldX for every user.

I think this can be done everywhere with a plugin using hook fetch_musername and code like this:
if (is_member_of($user, 27))
{
$user[musername] = '<span style="color:'.$user['field9'].'">'.$username.'</span>';
}

but I haven't tried it. There may be an issue with field9 being available when that hook is called.

kh99
01-04-2015, 02:59 AM
Yeah, that's not going to work in the "who's online" because of missing field9 for those users. A few other people have asked about similar things over the past few years, and I looked at the threads quickly but didn't find a complete answer. I'll look at it a little more tomorrow if you haven't worked it out by then.

TC-Jamech
01-04-2015, 01:14 PM
Yeah, that's not going to work in the "who's online" because of missing field9 for those users. A few other people have asked about similar things over the past few years, and I looked at the threads quickly but didn't find a complete answer. I'll look at it a little more tomorrow if you haven't worked it out by then.

Sadly, I have no idea how to make hooks lol, but if I try to replace memberinfo's username field with the one in postbit_legacy ($post[musername] it still doesn't work as the usernames disappear)

I've seen several sites use it, but non are prepared to share the code.

kh99
01-04-2015, 02:28 PM
OK, I made you a product xml that you should be able to import, and attached it. In case you don't know already, to do that you go to Plugins & Products > Manage Products and click on the "Add/Import Products" link at the bottom. Then press the "Choose File" button and find the xml file (you would have saved to your computer already), then press "Import".

I did try this but I'm not 100% certain it will add the color everywhere you need (some places just don't have it at all even if you set it in the usergroup manager). But you should be able to remove the edits you made in the postbit template, if you want.

Hopefully this is what you wanted. Otherwise, let me know.

TC-Jamech
01-04-2015, 04:40 PM
OK, I made you a product xml that you should be able to import, and attached it. In case you don't know already, to do that you go to Plugins & Products > Manage Products and click on the "Add/Import Products" link at the bottom. Then press the "Choose File" button and find the xml file (you would have saved to your computer already), then press "Import".

I did try this but I'm not 100% certain it will add the color everywhere you need (some places just don't have it at all even if you set it in the usergroup manager). But you should be able to remove the edits you made in the postbit template, if you want.

Hopefully this is what you wanted. Otherwise, let me know.

Thanks buddy, I've tested it and it shows on postbit & memberinfo, is their away of enabling it for the users online?

kh99
01-04-2015, 04:47 PM
I thought it would work for users online. Sorry if this is a stupid question, but what part are you talking about exactly? Is it "Currently Active Users" on index.php? Maybe I'm thinking of a different section.

TC-Jamech
01-04-2015, 04:52 PM
I thought it would work for users online. Sorry if this is a stupid question, but what part are you talking about exactly? Is it "Currently Active Users" on index.php? Maybe I'm thinking of a different section.

Yep that lil bit at the bottom of index.php, and also the members visited today box which is a mod. I tried modifyin that div but it's different coding to the postbit and only shows up as $activeusers

kh99
01-04-2015, 05:21 PM
Hmm...it's working for me in "Currently Active Users" (which was kind of the point of it). I don't think I can help you with the mod, I don't know anything about it.

Your VIP group is 27, and the profile field is 9, right? I hard-coded those in that plugin.

If you right click one of the user names and "Inspect Element" (or whatever it is for your browser), do you see the <span style="... tags around the user name?

TC-Jamech
01-04-2015, 06:11 PM
Hmm...it's working for me in "Currently Active Users" (which was kind of the point of it). I don't think I can help you with the mod, I don't know anything about it.

Your VIP group is 27, and the profile field is 9, right? I hard-coded those in that plugin.

If you right click one of the user names and "Inspect Element" (or whatever it is for your browser), do you see the <span style="... tags around the user name?

Yeah it's working fine now, just not in Chrome lol. I suppose I can live without the mod plugin :)

Just one more thing, how do I bold the usernames? as I currently have <b> </b> in the usergroup manager for that user, but isn't showing as bold? I'm guessing I need to modify the plugin you gave?

kh99
01-04-2015, 06:39 PM
Oh, yeah, I probably could have done it so that the markup from the usergroup manager was preserved. Try going to Plugins & Products > Plugin Manager, and find "Set username markup from profile field" and click on it. Then replace the code with this:
if (is_member_of($user, 9) && !empty($user['field5']))
{
$user[musername] = '<span style="color:'.$user['field5'].'">'.$user[musername].'</span>';
}

and press Save, and see how that looks.

TC-Jamech
01-04-2015, 11:35 PM
Oh, yeah, I probably could have done it so that the markup from the usergroup manager was preserved. Try going to Plugins & Products > Plugin Manager, and find "Set username markup from profile field" and click on it. Then replace the code with this:
if (is_member_of($user, 9) && !empty($user['field5']))
{
$user[musername] = '<span style="color:'.$user['field5'].'">'.$user[musername].'</span>';
}

and press Save, and see how that looks.

Cheers, I noticed a slight problem, When I have more than 1 usergroup it only shows the Custom VIP colour. Is there a way to have it so it only uses the "Display Usergroup"?

For instance, my admin usergroup is red, and despite having that as my primary & diplay usergroup it still has my name showing the additional userroup colour preference.

kh99
01-05-2015, 12:50 AM
OK, how will you know when you want the display usergroup and when you want the profile field color?

TC-Jamech
01-05-2015, 01:55 AM
OK, how will you know when you want the display usergroup and when you want the profile field color?

I want it so that if you go to www.site.com/profile.php?do=editusergroups

https://vborg.vbsupport.ru/external/2015/01/5.gif

And select "identify me as admin" it identifies you in your red username (which is within the usergroup manager for that group) whilst "identify me as VIP" would change your username to the custom colour.

At the moment, the only way to get a different colour shown is if that user removes the user colour hexcode in their settings

kh99
01-05-2015, 01:58 AM
Hmm...OK. So it might work out better if we take a different approach, and instead of using is_member_of() and adding markup, we could just check if the markup is the 'VIP' markup (maybe by putting an id attribute in the span tag), and if so, add the color.

I'll look at it tomorrow.

ETA: oh, and they're able to enter any hexcode they want? Then the plugin also needs to check for that, otherwise the could enter something like #000000;"> followed by any html or css they wanted.

TC-Jamech
01-05-2015, 03:10 AM
Hmm...OK. So it might work out better if we take a different approach, and instead of using is_member_of() and adding markup, we could just check if the markup is the 'VIP' markup (maybe by putting an id attribute in the span tag), and if so, add the color.

I'll look at it tomorrow.

ETA: oh, and they're able to enter any hexcode they want? Then the plugin also needs to check for that, otherwise the could enter something like #000000;"> followed by any html or css they wanted.

I can always edit the field so it only allows the #000000 *7 character :)

Scandal
01-06-2015, 12:35 PM
Try also this product (I had develope it some months ago). It is for vB4 but I test it and works fine with vB3.
After installation check vbulletin options. You can add usergroups (who can change color) and exclude colors from use.
You have only to add the field ID of the profile field which use for username colors and set the usergroup IDs.

Username color is changed globally.

kh99
01-06-2015, 01:37 PM
Oh good, I was meaning to get back to that. Now you've saved me the trouble.

TC-Jamech
01-06-2015, 06:08 PM
Try also this product (I had develope it some months ago). It is for vB4 but I test it and works fine with vB3.
After installation check vbulletin options. You can add usergroups (who can change color) and exclude colors from use.
You have only to add the field ID of the profile field which use for username colors and set the usergroup IDs.

Username color is changed globally.

Will give it a shot, do i need to undo the other changes I made to postbit etc?

Scandal
01-07-2015, 10:25 AM
Will give it a shot, do i need to undo the other changes I made to postbit etc?
Yes, this hack doesn't need template edits. :)

DCD.RB
07-07-2018, 02:36 AM
Try also this product (I had develope it some months ago). It is for vB4 but I test it and works fine with vB3.
After installation check vbulletin options. You can add usergroups (who can change color) and exclude colors from use.
You have only to add the field ID of the profile field which use for username colors and set the usergroup IDs.

Username color is changed globally.

This is a great plugin, but I found that it doesn't change the color on the thread listing info:
- Thread Starters
- Last Posters
- Online users info per forum

Does anyone know how to add a hook to cover those?

Thanks!