I've been using the Front Page module successfully in Drupal 6 for a while now, but just recently decided to take things to the next level and start playing with role specific front pages. However, this feature seems to be horribly broken in D6, most of the time defaulting any role back to authenticated user.

After trying to get things going through a combination of permissions checking, clearing and resetting the admin page to and from front_page, and cache-clearing, I gave up and dug into the code.

It turns out that at least in D6, the module isn't checking whether or not the "access frontpage" permission is given to any particular role. It's simply matching up A ROLE that the user has to it's associated front page. The highest roll in the hierarchy (the order at the top of the admin page) that the user has will get that particular front page, regardless of if the role had permission to use it.

Luckily, this is easily enough to fix with the code we already have in Drupal 6 (theoretically back-portable too, according to the API, but I'm not a D5 expert).

On line 331 of front_page.module, we have
$roles = user_roles(); //load up the user roles for the site

instead of loading all the roles in our site, I simply provided it with the already existing permission set--

$roles = user_roles(FALSE, "access frontpage"); //load up the user roles for the site

And now the module works as intended. Lines 22 and 77 feature the exact same line of code, and updating these lines in the same manner made the UI MUCH more manageable, changing the help text (role hierarchy) and the front page forms themselves to only include roles that have the "Access Frontpage" permission.

I probably should have submitted this as a patch, but it's late and I don't feel up to it at the moment. If I remember, I'll come back to it and submit these changes as a patch proper.

Comments

timhilliard’s picture

Status: Active » Needs review

Hi sjorgnsn, thanks for the catch, this has now been added to 6.x-1.3. Please also have a look at 6.x-2.x version which works a bit different to the old version and you may find it a bit more intuitive and easier to use.

Thanks,
Tim

mckinleymedia’s picture

Title: Front Pages by Role not working correctly in D6 (FIXED!) » Problems creating role-specific pages(solved)

I had problems creating role-specific pages. I had the permissions set so any authenticated user could "access frontpage." It turns out you need to give specific permissions to EACH role that you want to be able to have a separate front page.

simon georges’s picture

Title: Problems creating role-specific pages(solved) » Problems creating role-specific pages
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.