You are here

function protected_pages_access_callback in Protected Pages 7

Same name and namespace in other branches
  1. 7.2 protected_pages.module \protected_pages_access_callback()

Callback function to determine who can enter a password.

1 string reference to 'protected_pages_access_callback'
protected_pages_menu in ./protected_pages.module
Implements hook_menu().

File

./protected_pages.module, line 94
This module allows you to protect any page of your website by secure password. You can enter urls of pages to protect and set password per page. Admin (uid = 1) or user with bypass protection permission can view page.

Code

function protected_pages_access_callback() {
  global $user;
  if ($user->uid == 1) {
    return TRUE;
  }
  if (!user_access('access protected page password screen')) {
    return FALSE;
  }
  if (empty($_GET['protected_page']) || !is_numeric($_GET['protected_page'])) {
    return FALSE;
  }
  return TRUE;
}