I am in the process of setting up an e-commerce site (Drupal + e-commerce). I want to divide registered users into several categories and present each category with a different homepage. The homepage will probably be a category view, but, in general, I would like to have the freedom to choose any node, be it a static page or a dynamically generated view.
I downloadedand installed the frontpage module, which works correctly, but I have run into the following issue:
I set up a homepage for anonymous users, let us say node/3. I set up another homepage for registered user, let us say node/5. The only method in frontpage I can use (at least think) is "redirect". However, under the following scenario I will not get the intended homepage:
I come to the site as an anonymous user.
The site presents me "front_page" as the front_page.
The frontpage module redirects me to node/3, which is correct.
I log into the site.
The URL will not change, so I will again get node/3.
I have to click on a link to the homepage (e.g. the logo), which will give me front_page and then redirect me to node/5 as an authenticated user.
The problem is that the front_page does not pull the required node in the background, but uses redirect and thus looses its control over the homepage.
Perhaps I am doing something wrong. I just need a method of pulling in the required node in the background, so that the URL in the browser does not change.
Comments
Comment #1
Phillip Mc commentedquick answer. Because you have already redirected away from the front_page...the front_page.module no longer controls output.
you have 2 options.
(a) in the text area settings for anonymous users (on the front page settings page) either use that text area for the anonymous users page (instead of using a redirect) or use a php snippet to "pull" node/3 content into the front page.
example snippet:
That snippet will load node 3 and display the contents of that node. Remember to select ALLOW EMBEDDED PHP before saving your new front page settings.
(b) you can install a module called login_destination which allows you to control login destinations. You want to redirect logins to the 'front_page', rather than the current node.
Option (a) is obviously better, because it doesn't require an extra module.
Comment #2
Robert_SK commentedYes, you exactly got the point. As I mentioned in my post, I would like to be able to load an arbitrary page, not only a standard node. Is there a php snippet that can pull in any page according to URL, or at least a (category) view?
Comment #3
Phillip Mc commentedif you're using the views.module to output your category view...try this (edit 'your_view_name' to suit) snippet in your front_page.module settings page, using the same step by step as I posted earlier:
For more details on options etc. click through to the handbook page that explains how to Insert views.
If you're not using views...you could try this snippet that allows you to Display a list of (x) node titles and links to the full node from multiple taxonomy/category terms (that's marked for Drupal 4.7 but it may work with version 5.x without any tweaking).
Alternatively, click through to the php page snippets of the handbook, which might have a snippet to suit.
Comment #4
Phillip Mc commented