By sammybaby on
I'm working on putting together a custom PHPTemplate theme for what is largely going to be a static site - the author will mostly be editing it only to update a "news & events" page. I (and he) will not want the login form to be visible to anonymous users on the site, so I'm working on hiding the "$left_sidebar" in the theme so that it's only visible while administering the site.
The tricky part is telling the theme where that is. So far, the best I've been able to come up with is:
if( (arg(0) == "admin") || ($user_is_logged_in) ) {
print $sidebar_left;
}
Obviously, $user_is_logged_in won't work. What should I have there instead? Or is there a better solution I'm missing?
Thanks in advance.
Comments
You can simplify that
Since you normally need to be logged to see the admin section you can simplify that to
Except that will hide the
Except that will hide the login form from everyone, won't it? The login form is in the sidebar, the sidebar doesn't print unless you're logged in, and if you're logged in you'll see your menu instead of the form. Sort of a catch 22. :)
user
Quote:
"Except that will hide the login form from everyone, won't it? The login form is in the sidebar, the sidebar doesn't print unless you're logged in, and if you're logged in you'll see your menu instead of the form. Sort of a catch 22. :)"
But if you write:
http://localhost/portal/user
You could log on without any problem.
Aha! Didn't know about the
Aha! Didn't know about the other login form. Thank you. :)
That's correct
To make to only show the login block for people not logged in you could use
This way people who are logged in see the left sidebar and people who are not logged in see the login block.