Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
By JurriaanRoelofs on
Hiya, I tried to code this in phptemplate, I wrote this is page.tpl.php:
//if user is logged in, show left, if user is also admin, show right.
global $user;
if ($user->uid) {
if ($user->uid == 1) {
print $sidebar_left;
} else {
print $sidebar_right;
}
} else {
return;
}
If the admin is logged in, it seems to work fine and I get the left column block, but when I went to my site as anonymous the page just stopped where I pasted this code.
Like in the middle of the HTML, there was just blank.
The code is not supposed to show any block to anonymous users but I do want the rest of the page markup to render because my site is busted without it.
what's wrong with my code?
Comments
I just discovered that the
I just discovered that the code work like it's supposed too when the admin is logged in, but when the admin logs off, the sites is broken for everybody
-------------------------------
http://www.sooperthemes.com/#-Drupal-Themes
return statement is the problem
The code ends with
and is the section that handles anonymous users. The return statement though is causing it to stop processing the page. You can drop the 'else' along with the return statement and things should be fine.
that was it, thanks :)
that was it, thanks :)
-------------------------------
http://www.sooperthemes.com/#-Drupal-Themes