Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By wpanssi on
What would be the best way to implement a different frontpage for anonymous user? So that authenticated and anonymous users could have different default frontpages.
Some redirection to different page if user is not logged in? If so, which would be appropriate place for the redirection to take place and can I tell drupal to do that by manipulating some variables or what..?
Tnks
Comments
Put this into your
Put this into your template.php (theme's folder):
Now clear cache from the 'performance' page (site configuration).
Now create the following files in your theme's folder: page-front.tpl.php and page-front-anonymous.tpl.php.
Copy data from page.tpl.php to these new files and modify at will!
More good stuff at: http://yubastudios.com/blog/drupal-extending-templating
---
Yuriy Babenko
www.yubastudios.com
My Drupal tutorials: http://yubastudios.com/blog/tag/tutorials
---
Yuriy Babenko | Technical Consultant & Senior Developer
http://yuriybabenko.com
Front Page module
You might also try the Front Page module.
Here's a trick I used before
Here's a trick I used before I started creating my own modules.
I created a new Page and gave it a url of 'home'. In your site-info settings, make 'home' your default front page.
Then I made two other Pages and gave one the url of 'welcomeback' and the other the url of 'welcomenew'
Then you edit the 'home' page and place the following php in it:
Now you have two different front pages: one for registered users (called 'welcomeback') and one for anonymous users (called 'welcomenew'). Edit them as desired.
This works well, though it does result in a double-page load on the server whenever someone visits the front page of the site. It never caused a problem on the sites I've placed this strategy on.
Thanks to all of
Thanks to all of you!
--
http://www.sitemedia.fi
Thanks
I appreciate your really straightforward and clean approach .
Update for Drupal 7
The above is very dated. Here is the relevant user contributed documentation: https://www.drupal.org/node/223440
(At the time of writing, it only covers D6 and D7, tho'.)
- gisle