MyBB Community Forums

Full Version: Use HTML in custom titles (admins only)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi Smile

I want admins, only admins, to be able to use html markup in their custom titles, not only via the admin cp (for which there already is a plugin), but also via their user cp.

So far I have this:

in the /inc/datahandlers/user.php,

I changed this
if(isset($user['usertitle']))
        {
			$this->user_update_data['usertitle'] = $db->escape_string(htmlspecialchars_uni($user['usertitle']));	
		}

into this
if(isset($user['usertitle']))
        {
			$this->user_update_data['usertitle'] = $db->escape_string($user['usertitle']);	
		}

So with these changes EVERYONE, regardless of which usergroup they are in, can use html in their custom title, but I only want admins to be able to.

I already tried a couple functions in addition to the code above to achieve this, but so far no luck Confused

I'm gonna need some help on this, and hoping to find it in here.

Thanks in advance Smile
if(isset($user['usertitle']) && !$mybb->usergroup['cancp'])
        {
            $this->user_update_data['usertitle'] = $db->escape_string(htmlspecialchars_uni($user['usertitle']));    
        } 
else if(isset($user['usertitle']) && $mybb->usergroup['cancp'])
        {
            $this->user_update_data['usertitle'] = $db->escape_string($user['usertitle']);    
        } 

Try that. It should work.
if ($mybb->user['usergroup']==4)
{
// admin
code goes here
}
else
{
// Nonadmin
code here
}
(2012-04-04, 03:52 PM)Nathan Malcolm Wrote: [ -> ]
if(isset($user['usertitle']) && !$mybb->usergroup['cancp'])
        {
            $this->user_update_data['usertitle'] = $db->escape_string(htmlspecialchars_uni($user['usertitle']));    
        } 
else if(isset($user['usertitle']) && $mybb->usergroup['cancp'])
        {
            $this->user_update_data['usertitle'] = $db->escape_string($user['usertitle']);    
        } 

Try that. It should work.

Wow, that was fast! Big Grin Thanks for your reply, it's much appreciated Smile Sadly, it didn't work Confused
Change:

global $db, $plugins, $cache;

to:

global $mybb, $db, $plugins, $cache;
(2012-04-04, 03:53 PM)dragonexpert Wrote: [ -> ]
if ($mybb->user['usergroup']==4)
{
// admin
code goes here
}
else
{
// Nonadmin
code here
}

Doesn't work either Sad Thanks though Wink

(2012-04-04, 04:09 PM)Nathan Malcolm Wrote: [ -> ]Change:

global $db, $plugins, $cache;

to:

global $mybb, $db, $plugins, $cache;

Oh.. My.. God, I can't believe I forgot to add that Blush Silly me Big Grin

Thanks, if it wasn't for you there's no telling how long it would have taken me to finally realize I forgot to add the $mybb to this file Toungue Stuff like this always happens to me.

+1
(2012-04-04, 04:09 PM)Nathan Malcolm Wrote: [ -> ]Change:

global $db, $plugins, $cache;

to:

global $mybb, $db, $plugins, $cache;

um, bump! I cannot seem to find this line of code, any help?
It's the first line of the update_user() method.
Um can you direct me to that (newbie)
It's in ./inc/datahandlers/user.php as mentioned in the OP.
Pages: 1 2