PDA

View Full Version : Usergroup mark-up based off of userfield


James Birkett
06-18-2010, 11:39 PM
Hi guys,

Basically, I have a VIP usergroup (who all have the same permissions) and I want to be able to allow them to change their username colour by specifying a hex value (from a drop-down list) in their profile.

The only way I can think of doing this is by grabbing the field, then sending it to the fetch_musername hook and setting a custom $user['musername'] style.

I don't think the fetch_musername hook allows me to use the $post['fieldX'] variable globally across the forum, so I'm going to have to grab the field value (probably from fetch_userinfo) and send it to that hook.

Does anyone have any ideas on how I can accomplish this?


Thanks in advance.

--------------- Added 1276992160 at 1276992160 ---------------

Can anyone assist with this?

James Birkett
06-20-2010, 05:48 PM
I've tried fetching the contents of the $post['fieldX'] variable and putting that directly into a plugin, but that has failed.

James Birkett
06-23-2010, 09:12 PM
Does nobody have any idea on how to do this? I've tried all sorts!

Lynne
06-23-2010, 09:20 PM
I think the hook would allow you to use the variable, however, did you look at the function? The $post variable, or whatever it is called when passed to the function, is called $user in the function. So, you would need to call it $user['fieldx'] in your plugin.

James Birkett
06-23-2010, 09:50 PM
Hi Lynne,

I greatly appreciate the reply!

I have this code on the fetch_musername hook:

if(!empty($user['field14']) && is_member_of($bbuserinfo, 6)){
$user['musername'] = "<span style=\"color:#".$user['field14'].";\">".$user['username']."</span>";
}

This doesn't seem to affect the username.

Lynne
06-24-2010, 04:13 AM
James, go read the function. $bbuserinfo is nowhere in there. Not only that, in php, it would be $vbulletin->userinfo, not $bbuserinfo. But, as I said, the variable there is called $user.

James Birkett
06-24-2010, 12:06 PM
Thanks Lynne, I've managed to get this to work now.