function _contact_personal_tab_access

_contact_personal_tab_access($account)

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

Parameters

$account: The user object of the user whose contact form is being requested.

File

modules/contact/contact.module, line 115
Enables the use of personal and site-wide contact forms.

Code

function _contact_personal_tab_access($account) {
  global $user;

  // Anonymous users cannot have contact forms.
  if (!$account->uid) {
    return FALSE;
  }

  // User administrators should always have access to personal contact forms.
  if (user_access('administer users')) {
    return TRUE;
  }

  // Users may not contact themselves.
  if ($user->uid == $account->uid) {
    return FALSE;
  }

  // If the requested user has disabled their contact form, or this preference
  // has not yet been saved, do not allow users to contact them.
  if (empty($account->data['contact'])) {
    return FALSE;
  }

  // If requested user has been blocked, do not allow users to contact them.
  if (empty($account->status)) {
    return FALSE;
  }

  return user_access('access user contact forms');
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!contact!contact.module/function/_contact_personal_tab_access/7.x