show yuimenu to only one role

lelizondob - April 10, 2008 - 14:00
Project:YUI Menu
Version:5.x-2.4
Component:Documentation
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

I was trying to show the yuimenu to only one role and I couldn't find any docs available. I want to share my solution:

Add this to the page.tpl.php, you will have to change "users" in $approved_roles = array('users'); to the role name of your choice. This helps so you can hide the menu to annonymous users. Thanks to the developer of this module, I was trying to use an alternative to simplemenu as I found it very hard to theme.

<div id="yuimenu">
<?php
global $user;
$approved_roles = array('users');

if (
is_array($user->roles)) {
  if (
count(array_intersect($user->roles, $approved_roles)) > 0) {
    print
html_menu(variable_get('yuimenu_root','1') );
  } else {

}}
?>

</div>     

Thanks to http://drupal.org/node/86241

#1

lelizondob - April 10, 2008 - 14:01
Status:active» fixed

just to change the status

Luis

#2

Anonymous (not verified) - April 24, 2008 - 14:12
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.