MyBB Community Forums

Full Version: How do to if user is in a group, bar change?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi!
I have this code:
<script>
function imagem2 ()
{
x=document.getElementById("demo")
x.style.opacity="100";
}
function imagen2 ()
{
x=document.getElementById("demo")
x.style.opacity="0";
}
</script>
<if $mybb->user['additionalgroups'] == 22 then>
<div id="cf">
<img class="bottom" src="images/1company/mod-bar.png" id="demo" />
<img src="{$displaygroup['image']}" alt="{$usertitle}" title="{$usertitle}" class="top" onmouseover="imagem2()" onmouseout="imagen2()" /><br />
</div>
<else>
<img src="{$displaygroup['image']}" alt="{$usertitle}" title="{$usertitle}" /><br />
</else>
</if>

But bar isn't changing, and i want if user is of a group, they bar change when the mouse is on bar. If i change to:
<if $GLOBALS['mybb']->user['usergroup'] == 22 then>
Doesn't make any difference.

Help!

-Google Translator.
<if $mybb->usergroup['gid'] = 22 then> is it a typing mistake or actual code
(2013-09-28, 05:35 PM).m. Wrote: [ -> ]<if $mybb->usergroup['gid'] = 22 then> is it a typing mistake or actual code
I see the dumb thing in it. Just ignore =P
But no, it isn't the actual code.
<else> tag shouldn't be closed. The proper syntaxes are:
<if $something then>
<b>hello</b>
<else>
<i>world</i>
</if>
and:
<if $something_else == 4 && count($array) > 10 then>
{$array['11']}
<elseif $something_else == 4 && count($array) < 10 then>
{$array['1']}
<else>
nothing
</if>

Also you may want to check both primary and additional groups at the same time.

Or if you have PluginLibrary could use is_member function (needs to be added as allowed function to .txt file).
Well, i removed the </else> but nothing changes...
And i don't know PHP... I tried to much arrays but nothing is working ;-;
*Bump*
^ where exactly you are using the code (which template) and whom you are showing changed image ?
<if $mybb->usergroup['gid'] = 22 then> --> here checking is done for user group of the visitor

edit: also what is value of {$displaygroup['image']} - whose display group and how it gets its value !