Wow, this is probably pretty easy.

I'm creating a menu on the top of my drupal site & then want to have a second menu for those that are logged in.

for this second menu, I'm planning on just using the "navigation block" How do I activate this block for only those who are logged in?

thank you.

Comments

pulsifer’s picture

This is easy with Drupal v4.7:

Click "adminster".
Click "blocks".
On the line for the Navigation block, click "configure".
Under "Page specific visibility settings", select "Show if the following PHP code returns TRUE".
In the text box, enter:

<?php global $user; return $user->uid != 0; ?>

Click "Save block"

Not sure how you would do this with Drupal v4.6.

budda’s picture

You'd do it in 4.6 by upgrading to 4.7 ;-)

jeditdog’s picture

Ok, I think I could consider this (if I do will my modules I've programmed in 4.6 work in 4.7 using the same hooks?)

So how would I do it in 4.7?

gunnettmd’s picture

You could do a simple check at the beginning of your logged in menu using php. Something similar to below.

<?php 
global $user;
if ($user->uid) {
input your menu here.
}?>

Mike of Sighing Sage

markchitty’s picture

For those of you who want to do this on 4.6 just enclose the content of block.tpl.php in the following conditional statement:

	global $user;
	if(($block->subject!="Navigation")||($user->uid!="0")) {
 

[Template HTML goes here]

}