You are here

function profile2_profile2_access in Profile 2 7.2

Same name and namespace in other branches
  1. 7 profile2.module \profile2_profile2_access()

Implements hook_profile2_access().

File

./profile2.module, line 1068
Support for configurable user profiles.

Code

function profile2_profile2_access($op, $profile = NULL, $account = NULL) {
  if (isset($profile) && ($type_name = $profile->type)) {
    if (user_access("{$op} any {$type_name} profile", $account)) {
      return TRUE;
    }
    $account = isset($account) ? $account : $GLOBALS['user'];
    if (isset($profile->uid) && $profile->uid == $account->uid && user_access("{$op} own {$type_name} profile", $account)) {
      return TRUE;
    }
  }

  // Do not explicitly deny access so others may still grant access.
}