Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Implementation of hook_perm().
- */
- function odp_perm() {
- return array('log in');
- }
- /**
- * Implementation of hook_user
- * lock out without the 'log in' permission
- */
- function odp_user($op, &$edit, &$account, $category = NULL) {
- if ($op == 'login' && ! user_access('log in')) {
- drupal_set_message("You do not have access to log in.", "error");
- drupal_goto('logout'); //doesn't work
- drupal_goto('content/party-tonight'); //also doesn't work
- }
- }
- /**
- * Implementation of hook_user
- * lock out without the 'log in' permission
- */
- function odp_user($op, &$edit, &$account, $category = NULL) {
- if ($op == 'login' && ! user_access('log in')) {
- global $user;
- $user = drupal_anonymous_user();
- drupal_set_message("You don't have permission to log in");
- }
- }
- /**
- * Implementation of hook_user
- * lock out without the 'log in' permission
- */
- function odp_user($op, &$edit, &$account, $category = NULL) {
- if ($op == 'login' && ! user_access('log in')) {
- drupal_set_message("You don't have permission to log in");
- //prevent login
- header("Location: http://www.example.com/?q=logout");
- // header("Location: http://www.example.com/logout"); if using clean URLs
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement