I'm using Drupal 5.x.

I need to know how to remove the primary links I'm using for Navigation on my site from the login page. Everything on my login page looks good except that the tabs in the upper right corner show. I just don't want them to be seen until a user is logged in.

Thanks!

Kristen

Comments

panis’s picture

from just the login page or from all pages before the user has logged in?

for just the login page:
Option A;
In the page.tpl.php file wrap the primary-links print statement like so:

<?php
global $user;
if($user->uid || arg(0) != 'user') {
  print theme('links', $primary_links.....);
}

Option B:
- copy the page.tpl.php file over to a page-user.tpl.php file and edit it.
Look for the line that says something like "theme('links', $primary_links,..) and remove it.

- drupal will use the page-user.tpl.php file as the template file when you go over to the login page. this may also screw up your user profile pages.

For from all pages before the user has logged in - you can do Option A and remove the ||arg(0) bit

there are other options: define a region to contain the navigation links in your template.php file - add the primary links to this block - edit the page.tpl.php file and replace the print of the primary_links with the region you defined. head over to block configuration and disable this block from being displayed for an anonymous user on the "user" page.

turkeybat’s picture

From all pages would be good, before a user is logged in. I'm really new to Drupal so I don't know where to find the page.tpl.php file to alter it. Could you tell me how to do this?

Thank you!

VM’s picture

page.tpl.php is in the theme folder of the theme in use.

_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )

turkeybat’s picture

To remove athe tabs for all pages of users not logged in...

This is what is currently there...

if ($primary_links) { print "withprimary"; } if ($secondary_links) { print " withsecondary"; } ">
if ($primary_links):
print theme('menu_links', $primary_links)

endif;

I need to change it to...?

if ($primary_links) { print "withprimary"; } if ($secondary_links) { print " withsecondary"; } ">
if ($primary_links):
print theme('menu_links', $primary_links)
 global $user;
if($user->uid != 'user') {
  print theme('links', $primary_links);
}
            </div>
          <?php endif; 

I'm not familiar with this code so I'm not sure where to put this. I don't want to mess up anything so I'd like to do this correctly!

Thank you :)

VM’s picture

remove

<?php if ($primary_links): ?>


<?php print theme('menu_links', $primary_links) ?>

replace with:

<?php
global $user;
if($user->uid != 'user') {
  print theme('links', $primary_links);
}
?>

<?php endif; ?>

would help if we knew what theme you are using to give theme specific help
_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )

turkeybat’s picture

Ok just did it. Now when I go to my website all I see is this:

Parse error: syntax error, unexpected '<' in /home/mywebsite/public_html/sites/all/themes/bluebreeze-5.x-1.2/page.tpl.php on line 49

VM’s picture

blue breeze puts the primary links in a div that being said you need to find:

<?php if ($primary_links): ?>
            <div id="primary" class="clear-block">
              <?php print theme('menu_links', $primary_links) ?>
            </div>
          <?php endif; ?>

and replace with

<?php if ($primary_links): ?>
            <div id="primary" class="clear-block">
<?php 
global $user;
if($user->uid) {
     print theme('links', $primary_links);
}
?>
            </div>
<?php endif; ?>

give that a run, this should not allow primary links to be shown unless the user is indeed logged in.

_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )

turkeybat’s picture

You are awesome! It worked! I would not have been able to figure this on my own. Or many of the other aspects of this website I'm trying to build without your help. I truly appreciate the time you have taken to help me! Now on to the next task, the address book!