From the TODO:
-1. Allow Drupal site administrators to specify a specific front page based on ROLE types.
The attached patch enables a different splash and default home page for each role. Implementing this has required significant changes to the module. In particular, it didn't seem practical to stick with the saving of all these home pages via variable_set. Instead, splash pages are regular nodes of whatever type and home pages are any Drupal path.
This approach arguably has the added advantage of keeping home page content within the regular node system, which solves some outstanding issues on the project (pages are translatable, indexed by search, etc.).
Administration of home pages is moved to the regular admin/settings page. We unset the existing site_frontpage form element and replace it with a table for designating home pages by role.
In addition to the patch there is a small .install file to claim site_frontpage. I'll include this in a followup post.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | front-roles-settings.png | 10.07 KB | nedjo |
| #1 | front-roles.tar.gz | 2.3 KB | nedjo |
| front-by-role.patch | 16.13 KB | nedjo |
Comments
Comment #1
nedjoA tarball with the .install file and a patched version of front_page.module, for people who might wish to test without having to patch.
Comment #2
nedjoScreenshot of the form elements for setting splash and regular front pages.
[Note: I forgot to include README.txt edits in the patch. I'll leave this until a later iteration when the idea has been discussed a bit.]
Comment #3
nedjoIf this patch is accepted, it would be good to consider a call on role_weights.module to determine the role to use for a given user's front page (if that user has more than one role).
See this patch on role_weight: http://drupal.org/node/70748, "Use form_alter to integrate weights into regular role editing". If that is accepted, we could use role_weight as a dependency and then have a way to add the front page selection directly to the editing form for each role--a more logical place for it than the current table in admin/settings.
See also this additional patch on role_weight, http://drupal.org/node/70763, "Allow users to select role for session (through block)". If that is accepted, we could consider using the proposed method
role_weights_get_user_primary(), so that users can reset their primary role (hence, their home page) during a session.Comment #4
dublin drupaller commentedI think this is a great idea....will have a look at the patches nedjo.
Dub
Comment #5
sanduhrsThis is great, I like the flexibility it provides.
The Block user-login-form apparently doesn't work anymore.
I tried to login from a defined frontpage, but it doesn't seem to do anything.
vg
Comment #6
dublin drupaller commentedI agree sandhurs, although, I'm trying to strip down the patch to keep it simpler. Will have a look at that block login problem as well while I'm doing that.
Dub
Comment #7
lenzjo commentedI tried the patch, no matter what path I entered I was redirected to /node. So I tried the files from post #1 above, still the same result... I was hoping this would work as I was going to try modifiying it to use og groups instead of roles.
Comment #8
dublin drupaller commentedI'm looking at an alternative to this patch at the moment, will post back up here when I have it sorted.
Dub
Comment #9
dublin drupaller commentedHi Nedjo,
thanks for the suggested patch, but, I've gone with an alternative method of allowing site admins to specify a custom front page by role.
more details here: http://drupal.org/node/83593
Dub