PDA

View Full Version : Hiding Elements


Varsh
12-09-2008, 12:15 PM
Currently I've been trying to create a completely new style however despite being able to create and display templates fine, hiding elements from users and other usergroups just doesn't seem to work for some reason. If I put all of the elements in a new template it won't work, however putting them in the navbar element works.

Is there something I need to put into the plugin to get the elements to hide? Putting the code in the navbar will not work for this style so putting code in the navbar isn't really an option.

Any help is appreciated. :)

I have tried:
<if condition="$show['member']">
and:
<if condition="$show['admincplink']">
without any success so...

Digital Jedi
12-09-2008, 12:17 PM
What are you trying to hide exactly, and from whom? I'm not sure I understand what your trying to do.

Varsh
12-09-2008, 12:28 PM
At the moment I'm trying to create a new navbar, however there's certain options (like the current navbar) that I want hidden from guests and only show up if you're registered. Think of it like copying the current navbar to a different template.

This is what I'm trying to do at the moment:
http://img218.imageshack.us/img218/6439/navbarre0.jpg

I pasted the code from the custom template and put it into the navbar template and it worked fine, I'm trying to figure out why it doesn't work in the custom template. Also the bottom part of the new navbar is supposed to be hidden from guests, which also works in the navbar template but not the custom template. You can test what I mean on my site using test/pass.

Seven Skins
12-09-2008, 01:07 PM
<if condition="$show['member']">

^^ this should have worked as I have tried this long time back and it worked.

Can you post the code from your custom template?

.

Varsh
12-09-2008, 01:23 PM
That's exactly what I did funnily enough, the custom template looks like this:
<ul id="topMenu">
<li><a href="http://www.nexusrealms.co.uk">Home</a></li>
<li><a href="http://media.nexusrealms.co.uk">Media Projects</a></li>
<li><a href="http://forums.nexusrealms.co.uk/project.php">Projects Tools</a></li>
<li><a href="http://forums.nexusrealms.co.uk">Forums</a></li>
<li><a href="http://forums.nexusrealms.co.uk/faq.php">FAQs</a></li>
<li><a href="http://wiki.nexusrealms.co.uk">Wiki</a></li>
</ul>
<if condition="$show['member']">
<ul class="topMenu2 blue">
<li><a href="http://forums.nexusrealms.co.uk/usercp.php">Control Panel</a></li>
<li><a href="http://forums.nexusrealms.co.uk/search.php?$session[sessionurl]do=finduser&amp;u=$bbuserinfo[userid]">My Posts</a></li>
<li><a href="http://forums.nexusrealms.co.uk/search.php?do=getnew">New Posts</a></li>
<if condition="$vboptions['enablememberlist']">
<li><a href="http://forums.nexusrealms.co.uk/memberlist.php$session[sessionurl_q]">$vbphrase[members_list]</a></li>
</if>
<if condition="$show['member']">
<li><a href="login.php?$session[sessionurl]do=logout&amp;logouthash=$bbuserinfo[logouthash]" onclick="return log_out('$vbphrase[sure_you_want_to_log_out]')">$vbphrase[log_out]</a></li>
</if>
<if condition="$show['admincplink']"><li><a href="$admincpdir/index.php$session[sessionurl_q]">$vbphrase[admin]</a></li></if>
</ul>
</if>
And the plugins look like this:
global_start
eval('$nxr_topMenu = "' . fetch_template('nxr_topMenu') . '";');
cache_templates
$globaltemplates = array_merge($globaltemplates, array('nxr_topMenu'));
I would've used
globaltemplates[] = 'nxr_topMenu'; if I didn't get an error.

Seven Skins
12-09-2008, 02:03 PM
Hmmm

Try this:

<if condition="is_member_of($bbuserinfo, 5, 6, 7)">

Change the user groups as needed.

.

Varsh
12-09-2008, 02:40 PM
Ok that worked well, could be a big problem down the road though as I'll be making constant changes to usergroups. Also in the same code I'm finding that Logout and Admin CP links are not showing up either, there's got to be something that I'm doing wrong or have missed. In the bottom setup (for the navbar) the Admin CP just links to the index page rather than the admin CP so that isn't working for the navbar (moving form the footer). I've really got to figure all of this skinn molarchy out. o_O

Seven Skins
12-09-2008, 05:59 PM
What you can do is use <if condition="!is_member_of($bbuserinfo, 5, 6, 7)"> to exclude usergroups ;)

For adminCP link you can use

<if condition="is_member_of($bbuserinfo, 5, 6, 7)">

instead of

<if condition="$show['admincplink']">

Edit the usergroups accordingly.