You are here

function rh_user_user_view in Rabbit Hole 7.2

Implements hook_user_view().

File

modules/rh_user/rh_user.module, line 76
Main module file for Rabbit Hole users module.

Code

function rh_user_user_view($account, $view_mode, $langcode) {
  if ($view_mode != 'full') {

    // The user isn't viewed using the full view mode, exit early.
    return;
  }

  // Copy the behavior from the node_is_page() function to determine if the user
  // is being viewed at its own page.
  $page_user = menu_get_object('user');
  $user_is_page = !empty($page_user) ? $page_user->uid == $account->uid : FALSE;

  // Execute Rabbit Hole, if the user is being viewed at its own page, and the
  // current user isn't able to override Rabbit Hole.
  if ($user_is_page && !user_access('bypass rh_user')) {
    rabbit_hole_execute('user', $account);
  }
}