function profile2_category_access in Profile 2 7
Same name and namespace in other branches
- 7.2 profile2.module \profile2_category_access()
 
Menu item access callback - check if a user has access to a profile category.
1 string reference to 'profile2_category_access'
- profile2_user_categories in ./
profile2.module  - Implements hook_user_categories().
 
File
- ./
profile2.module, line 749  - Support for configurable user profiles.
 
Code
function profile2_category_access($account, $type_name) {
  $profile = profile2_load_by_user($account, $type_name);
  // As there might be no profile yet, create a new object for being able to run
  // a proper access check.
  if (empty($profile)) {
    $profile = profile2_create(array(
      'type' => $type_name,
      'uid' => $account->uid,
    ));
  }
  return $account->uid > 0 && $profile
    ->type()->userCategory && profile2_access('edit', $profile);
}