You are here

function _profile2_any_revision_access in Profile 2 7.2

Determine if any profile revision sub-tab is allowed access.

1 string reference to '_profile2_any_revision_access'
profile2_menu_alter in ./profile2.module
Implements hook_menu_alter()

File

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

Code

function _profile2_any_revision_access($account, $check_user = FALSE) {
  foreach (profile2_get_types() as $type_name => $type) {
    if (empty($type->data['use_page'])) {
      $profile = profile2_load_by_user($account, $type_name);
      if (_profile2_revision_access($profile, array(
        'view own profile revisions',
        'view any profile revisions',
      ))) {

        // An accessible tab has been found, so return.
        return TRUE;
      }
    }
  }

  // There are no accessible tabs.
  // If $check_user set, check access to user revisions.
  if ($check_user) {
    return _user_revision_access($account, array(
      'view user revisions',
      'view own user revisions',
    ));
  }
  return FALSE;
}