You are here

function me_me_uid_context in me aliases 7

Same name and namespace in other branches
  1. 8 plugins/arguments/me_uid.inc \me_me_uid_context()

Discover if this argument gives us the user we crave.

1 string reference to 'me_me_uid_context'
me_uid.inc in plugins/arguments/me_uid.inc
Plugin to provide an argument handler for user uid *and* "me"

File

plugins/arguments/me_uid.inc, line 33
Plugin to provide an argument handler for user uid *and* "me"

Code

function me_me_uid_context($arg = NULL, $conf = NULL, $empty = FALSE) {

  // If unset it wants a generic, unfilled context.
  if ($empty) {
    return ctools_context_create_empty('user');
  }

  // We can accept either a node object or a pure nid.
  if (is_object($arg)) {
    return ctools_context_create('user', $arg);
  }

  // Convert the "me" argument if needed.
  $arg = _me_check_arg($arg);
  if (!is_numeric($arg)) {
    return NULL;
  }
  $account = user_load($arg);
  if (!$account) {
    return NULL;
  }
  return ctools_context_create('user', $account);
}