function user_badges_block_view in User Badges 6.2
Same name and namespace in other branches
- 6 user_badges.module \user_badges_block_view()
- 7 user_badges.module \user_badges_block_view()
- 7.2 user_badges.module \user_badges_block_view()
- 7.3 user_badges.module \user_badges_block_view()
Function for user_badges_block(op = 'view').
1 call to user_badges_block_view()
- user_badges_block in ./
user_badges.module - Implements hook_block();
File
- ./
user_badges.module, line 1331 - @brief User Badges module file
Code
function user_badges_block_view($delta = 0) {
$block = array();
switch ($delta) {
case 'current_node':
$arg2 = arg(2);
if (arg(0) == 'node' && is_numeric(arg(1)) && empty($arg2)) {
$node = menu_get_object();
if (in_array($node->type, variable_get('user_badges_current_node_types', array()))) {
$badges = user_badges_for_user(array(
'uid' => $node->uid,
));
$account = user_load(array(
'uid' => $node->uid,
));
$block['title'] = t("@name's Badges", array(
'@name' => $account->name,
));
$block['content'] = $badges;
}
}
break;
}
return $block;
}