I am building a custom module for a client but I am not able to get anonymous users to access the custom pages. Instead it is giving the following message:
Access denied
You are not authorized to access this page.

I have the following code in my .module file:

function fixtures_perm() {
 return array('access fixtures content');
}

In my menu hook I have the following code:

  $items['pickyourproducts'] = array(
  'title' => '',
  'description' => 'Loads Pick Your Products form for the fixtures module.',
  'page callback' => 'pickyourproducts_page',
  'access callback' => 'user_access',
  'access arguements' => array('access fixtures content'),
  'type' => MENU_CALLBACK,
  'file' => 'pickyourproducts.module',
  'file path' => drupal_get_path('module', 'pickyourproducts'),
);

I have checked all the permissions in the permissions page for "access fixtures content".

Could anyone help me with this issue???

Comments

cayenne’s picture

I hope someone will provide a better answer, but here is what I did

1. Turn off all your caching
2. Hit the "rebuild permissions" button often (it's found in post settings)

Maybe that will fix it, maybe not. There is some sort of permissions cache that will bite ya. (I actually had to let the thing sit overnight)
If not

3. Change the access callback to 'access content'

that should surely work. If not, go to 1 and 2.

4. There "SHOULD" be an anonymous user access value built in, but I do not know what it is.

5. You can easily write an internal access function that returns TRUE all the time, or if uid==0, if that's what you want.

Good luck!

:)

arunms’s picture

Thanks for your quick response. I did clear cache and rebuild permissions several times. It din't work. How do I force access to a module, the one you have mentioned in step #5.

cayenne’s picture

For # 5 look up how to create an access function. I have not been successful at it myself, so....

:)

jaypan’s picture

You don't need the access callback (that is already the default), and your problem is that you spelled 'arguments' wrong.

Contact me to contract me for D7 -> D10/11 migrations.

arunms’s picture

Fixing the typo solved the problem. Jay, that was brilliant. Gash, I need to get a good editor.

cayenne’s picture

Good work Jay!

:)

jaypan’s picture

I learned that one from personal experience :D

Contact me to contract me for D7 -> D10/11 migrations.