function _user_relationship_blocks_view in User Relationships 6
Same name and namespace in other branches
- 5.2 plugins/user_relationship_blocks/user_relationship_blocks.module \_user_relationship_blocks_view()
helper function user_relationship_blocks_block delegates to when $op == 'view'
1 call to _user_relationship_blocks_view()
- user_relationship_blocks_block in user_relationship_blocks/
user_relationship_blocks.module - Implementation for hook_block
File
- user_relationship_blocks/
user_relationship_blocks.module, line 217 - User Relationship Blocks implementation @author Jeff Smick (creator) @author Alex Karshakevich (maintainer) http://drupal.org/user/183217
Code
function _user_relationship_blocks_view($block_type, $rtid, $extra, $bid) {
global $user;
$is_my_block = $block_type == UR_BLOCK_MY || $block_type == 'pending';
if ($is_my_block && !$user->uid) {
return;
}
$settings = _user_relationship_blocks_settings($bid);
$settings->rtid = $rtid;
$settings->block_type = $block_type;
// determine which user's relationships to display
if ($is_my_block && $user->uid) {
$account =& $user;
}
elseif ($uid = drupal_eval($settings->get_account)) {
$account = user_load($uid);
}
if (isset($account)) {
$add_to_string = in_array($block_type, array(
'pending',
'actions',
)) ? "_{$block_type}" : '';
return array(
'subject' => theme('user_relationship_block_subject', $bid, $account, $rtid, $extra),
'content' => theme("user_relationships{$add_to_string}_block", $account, $settings, $extra),
);
}
}