You are here

function _user_relationship_blocks_get_uid in User Relationships 7

Figure out which account is currently viewed.

Parameters

$delta: The delta of the block that is currently viewed.

Return value

Either the uid of the user owning the displayed profile, node or blog.

1 call to _user_relationship_blocks_get_uid()
user_relationship_blocks_block_view in user_relationship_blocks/user_relationship_blocks.module
helper function user_relationship_blocks_block delegates to when $op == 'view'

File

user_relationship_blocks/user_relationship_blocks.module, line 236
User Relationship Blocks implementation @author Jeff Smick (creator) @author Alex Karshakevich (maintainer) http://drupal.org/user/183217

Code

function _user_relationship_blocks_get_uid($delta) {

  // Call hook, this allows other modules to declare other ways to detect the
  // currently viewed user.
  foreach (module_implements('user_relationship_blocks_get_uid') as $module) {
    $function = $module . '_user_relationship_blocks_get_uid';
    if ($uid = $function($delta)) {
      return $uid;
    }
  }
  if ($node = menu_get_object()) {
    return $node->uid;
  }
  if ($user = menu_get_object('user')) {
    return $user->uid;
  }
  if (arg(0) == 'blog' && arg(1) > 0) {
    return arg(1);
  }
}