function author_pane_get_block in Author Pane 6.2
Same name and namespace in other branches
- 5 author_pane.module \author_pane_get_block()
- 6 author_pane.module \author_pane_get_block()
- 7.2 author_pane.module \author_pane_get_block()
Creates the contents of the block. Called from author_pane_block().
1 call to author_pane_get_block()
- author_pane_block in ./
author_pane.module - Implementation of hook_block().
File
- ./
author_pane.module, line 293 - Gathers information from user related modules into one template.
Code
function author_pane_get_block() {
$area = arg(0);
$context = NULL;
// Check that we're in the right area. The block only works on the user pages,
// node full view pages, and the blog listing pages. It also does not work on
// the "edit" subpath.
if (!($area == 'user' || $area == 'node' || $area == 'blog') || !is_numeric(arg(1)) || arg(2) == 'edit') {
return;
}
if ($area == 'user' || $area == 'blog') {
// On the user page or the user's blog listing. Get the UID from the URL.
$uid = arg(1);
}
else {
// We're on a node page so load the node.
$node = $node = menu_get_object();
$allowed_types = variable_get('author_pane_block_display_types', array());
if (empty($allowed_types[$node->type])) {
// Not a type we want to show on.
return;
}
$uid = $node->uid;
// When we're displaying along with a node, we'll want to send the node
// object into the theme function.
$context = $node;
}
// Load up the user object
$account = user_load($uid);
// Build the author pane
$author_pane = theme('author_pane', $account, 'author_pane_block', variable_get('author_pane_block_user_picture_preset', ''), $context);
return $author_pane;
}