You are here

function _panels_everywhere_find_user_context in Panels Everywhere 7

Same name and namespace in other branches
  1. 6 plugins/tasks/site_template.inc \_panels_everywhere_find_user_context()

Attempt to extract a user from the environment to turn into a context.

1 call to _panels_everywhere_find_user_context()
panels_everywhere_site_template_get_base_contexts in plugins/tasks/site_template.inc
Figure out the base contexts in use for the page.

File

plugins/tasks/site_template.inc, line 191

Code

function _panels_everywhere_find_user_context() {
  foreach (range(1, 3) as $i) {
    $user = menu_get_object('user', $i);
    if (!empty($user)) {
      return $user;
    }
  }
  foreach (range(1, 3) as $i) {
    $user = menu_get_object('user_uid_optional', $i);
    if (!empty($user)) {
      return $user;
    }
  }
  if (arg(0) == 'user' && is_numeric(arg(1))) {
    return user_load(arg(1));
  }
}