0

i'm working on a drupal 7 online payment module ,

and i need to know if there is a Drupal 7 function that can track (each time and for all the users) if 'the logging online user' is requesting an 'Access denied ' page , and then get the permission must the user have to access to that page

PS: i'm creating a drupal payment module , the payment will be by roles , for exemple ( user1 can create 'Blog content type' just if he has the permission on that, if not i i need to know which 'Access denied ' page he is in and it's role so i can show him a message to buy this role depending on the price in the database) all what i need is the string permission of the page

thanks in advance ^_^

  • Maybe it would help to know what your end goal is? It sounds like there must be a better/more efficient way to handle it than what you're proposing. – Mike Crittenden May 31 '13 at 19:39
  • @Mike Crittenden i'm creating a drupal payment module , the payment will be by roles , for exemple ( user1 can create 'Blog content type' just if he has the permission on that, if not i i need to know which 'Access denied ' page he is in and it's role so i can show him a message to buy this role depending on the price in the database) all what i need is the string permission of the page Thanks ^_^ – YassineEdouiri May 31 '13 at 19:44
0

The only answer I can think of is to roll this functionality yourself with some coding in a custom module.

You probably want to use Chain Menu Access and the drupal API function user_role_permissions.

You can use the chain menu access api to put a fired-last menu access check that does some comparisons over previous access checks and Roles:

<?php
  chain_menu_access_chain($menu, 'an/existing/path', '_mymodule_new_access_callback_check_permissions_to_roles');
?>

Then use the drupal api user_role_permissions to see what Role has X permission that was failed in a parent-chained access callback. You could store that for example in the users $_SESSION data. Then write a custom 404 page that shows them purchase options.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.