1
lucashaley
Hiding Submenus
  • 2005/5/14 1:58

  • lucashaley

  • Just popping in

  • Posts: 2

  • Since: 2005/5/14


Hello all --

I was just wondering if anyone knew a way of hiding menu submenus from different groups. For example, I would like to hide the News submenu (New Story,Archives) from anonymous users. Any ideas?

Thanks for any help!

-Lucas

2
m0nty
Re: Hiding Submenus
  • 2005/5/14 5:41

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


try editing the system_block_mainmenu.html template..

as follows:

<{if $xoops_isuser}>
<{foreach 
item=sublink from=$module.sublinks}>
          <
class="menuSub" href="<{$sublink.url}>"><{$sublink.name}></a>
        <{/foreach}>
<{/if}>

3
m0nty
Re: Hiding Submenus
  • 2005/5/14 5:42

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


that will hide all submenu links tho from anonymous..

4
lucashaley
Re: Hiding Submenus
  • 2005/5/14 18:22

  • lucashaley

  • Just popping in

  • Posts: 2

  • Since: 2005/5/14


Thats great -- thanks!

-Lucas

5
katerina
Re: Hiding Submenus
  • 2005/5/23 10:13

  • katerina

  • Just popping in

  • Posts: 4

  • Since: 2005/3/4 1


Hi,
I would like to use this hack too, but it doesn't work for me.
Is there any other special trick I have to do?
I refreshed the system modul, but it didn't help.

Can anybody help me?
Thanks
Katerina

6
mlynch
Re: Hiding Submenus
  • 2005/5/25 20:53

  • mlynch

  • Just popping in

  • Posts: 3

  • Since: 2005/5/25


Well, I had an issue similar to this. I didn't mind if users saw the submenu, I just didn't want them to be able to use it. To get around this, I used the following code:
//mlynch hack to check if member of group X
$perid $xoopsUser->getVar('uid');
$grpid 4   //Set this to the group id you want to allow
$allow 0;
$result $xoopsDB->query("select uid from xoops_groups_users_link where groupid = '$grpid' and uid = '$perid'");
while ( list(
$uid) = $xoopsDB->fetchRow($result) ) {
        
$person $uid;
        if (
$perid != $person) {
                
$allow 0;
        } else {
        
$allow 1;
        list(
$uid) = $xoopsDB->fetchRow($result);
        }
}
if (
$allow != 1) {
        
redirect_header("index.php"0_NOPERM);
        exit();
}
//end mlynch hack


The above code goes after this bit in the files I want to protect:
if (empty($xoopsModuleConfig['anonpost']) && !is_object($xoopsUser)) {
        
redirect_header("index.php"0_NOPERM);
        exit();
}



I'm no pro by any means, so it may be messy, but it works for me...

*edit* Working example of this code at:

http://craig.spherens.com
username: testtest
password: password

After logging in, try to Submit News and you will get redirected for not having proper access. The site users that are in the custom group 'Journalists' are able to get to the page and submit news.

7
katerina
Re: Hiding Submenus
  • 2005/7/4 13:36

  • katerina

  • Just popping in

  • Posts: 4

  • Since: 2005/3/4 1


I have some time to to test why the code added in
modules/system/templates/blocks/system_block_mainmenu.html
doesn't work and I find out following:

When I modify this file, no change will appear in xoops,
neither after refreshing the system modul.
I have to modify the file in templates_c/%%42^....3Asystem_block_mainmenu.html.php
to obtain any change.
What is wrong with my instalation?

If I put in templates_c/%%42^....3Asystem_block_mainmenu.html.php
print "user $xoops_isuser", it looks like $xoops_isuser is empty.
If I tried to modify xoops_version.php of the module I want to hide submenus:

// Menu
$modversion['hasMain'] = 1;
if ($xoops_isuser) {$modversion['sub'][1]['name'] = _MI_NEWS_SMNAME1;}
if ($xoops_isuser) {$modversion['sub'][1]['url'] = "submit.php";}

It doesn't work. $xoops_isuser is probably empty or false for all the users

Thanx for help

Login

Who's Online

200 user(s) are online (127 user(s) are browsing Support Forums)


Members: 0


Guests: 200


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits