You are here

function _contact_permissions_user_tab_access in Contact Permissions 6

Same name and namespace in other branches
  1. 7 contact_permissions.module \_contact_permissions_user_tab_access()

Menu access callback for a user's personal contact form.

Parameters

$account: A user account object.

Return value

TRUE if the user is allowed to have a contact form or FALSE otherwise.

1 string reference to '_contact_permissions_user_tab_access'
contact_permissions_menu_alter in ./contact_permissions.module
Implementation of hook_menu_alter().

File

./contact_permissions.module, line 35
Provides permissions for having a personal contact form

Code

function _contact_permissions_user_tab_access($account) {

  // Check core's contact access callback first
  $access = _contact_user_tab_access($account);
  if ($access) {
    $access = contact_permissions_check_access($account);
    if ($access) {

      // Drupal core contact module does not allow annonymous users.
      // Redirect to user login form and set
      // appropiate message for anonymous users.
      if (user_is_anonymous()) {
        drupal_set_message(t('You must login to contact <em>@name</em>', array(
          '@name' => $account->name,
        )));
        drupal_goto('user/login', drupal_get_destination());
      }
    }
  }
  return $access;
}