You are here

function author_pane_get_block in Author Pane 6

Same name and namespace in other branches
  1. 5 author_pane.module \author_pane_get_block()
  2. 6.2 author_pane.module \author_pane_get_block()
  3. 7.2 author_pane.module \author_pane_get_block()
1 call to author_pane_get_block()
author_pane_block in ./author_pane.module
Implementation of hook_block().

File

./author_pane.module, line 231
Gathers information from user related contrib modules into one template.

Code

function author_pane_get_block() {
  $image_path = variable_get('author_pane_block_image_path', NULL);
  $template = variable_get('author_pane_block_template', NULL);
  $area = arg(0);

  // Check that we're in the right area.
  if (!($area == 'user' || $area == 'node' || $area == 'blog') || !is_numeric(arg(1)) || arg(2) != '') {
    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;
  }

  // Load up the user object
  $account = user_load($uid);
  $author_pane = theme('author_pane', $account, $image_path, $template);
  return $author_pane;
}