You are here

function subuser_profile2_access in Subuser 8

Same name and namespace in other branches
  1. 7.2 subuser.module \subuser_profile2_access()

Implements hook_profile2_access().

File

./subuser.module, line 59
Provides primary Drupal hook implementations.

Code

function subuser_profile2_access($op, $profile = NULL, $account = NULL) {
  global $user;

  // Fall through if we're not checking access for the current user account
  if ((!isset($account) || $account->uid == $user->uid) && isset($profile->uid)) {
    switch ($op) {
      case 'view':
        if (subuser_access_view_callback($profile->uid)) {
          return TRUE;
        }
        break;
      case 'edit':
        if (subuser_access_edit_callback($profile->uid)) {
          return TRUE;
        }
        break;
      case 'delete':
        if (subuser_access_delete_callback($profile->uid)) {
          return TRUE;
        }
    }

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