You are here

function theme_advanced_forum_reply_link in Advanced Forum 6

Same name and namespace in other branches
  1. 5 advanced_forum.module \theme_advanced_forum_reply_link()
  2. 6.2 includes/theme.inc \theme_advanced_forum_reply_link()
  3. 7.2 includes/theme.inc \theme_advanced_forum_reply_link()

Theme function to format the reply link at the top/bottom of topic.

3 theme calls to theme_advanced_forum_reply_link()
advanced_forum_preprocess_advanced_forum_topic_header in ./advanced_forum.module
Preprocesses template variables for the topic header template.
advanced_forum_preprocess_comment_wrapper in ./advanced_forum.module
advanced_forum_preprocess_node in ./advanced_forum.module
Preprocesses template variables for the node template.

File

./advanced_forum.module, line 341
Enables the look and feel of other popular forum software.

Code

function theme_advanced_forum_reply_link($node) {
  if (user_access('post comments')) {
    if ($node->comment == COMMENT_NODE_READ_WRITE) {
      if (variable_get('comment_form_location_' . $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {

        // Comment form on seperate page
        $links['topic_reply'] = array(
          'title' => t('Post Reply'),
          'href' => "comment/reply/{$node->nid}",
          'attributes' => array(
            'title' => t('Share your thoughts and opinions related to this posting.'),
          ),
          'fragment' => 'comment-form',
        );
      }
      else {

        // Comment form is already on the page
        $links['topic_reply'] = array(
          'title' => t('Post Reply'),
          'href' => $_GET['q'],
          'attributes' => array(
            'title' => t('Share your thoughts and opinions related to this posting.'),
          ),
          'fragment' => 'comment-form',
          'query' => !empty($_GET['page']) ? "page=" . $_GET['page'] : NULL,
        );
      }

      // Change to using a button if so set
      if (variable_get('advanced_forum_button_links', 1)) {
        $links['topic_reply']['title'] = advanced_forum_theme_image(t('post-reply.png'), t('Post reply'));
        $links['topic_reply']['html'] = TRUE;
      }
    }
    else {

      // Post is locked
      $links['topic_locked'] = array(
        'title' => t('Topic Locked'),
        'attributes' => array(
          'title' => t('This topic is locked'),
        ),
      );

      // Change to using a button if so set
      if (variable_get('advanced_forum_button_links', 1)) {
        $links['topic_locked']['title'] = advanced_forum_theme_image(t('locked-topic.png'), t('Locked'));
        $links['topic_locked']['html'] = TRUE;
      }
    }
  }
  else {

    // User does not have rights to post
    $links['comment_forbidden']['title'] = theme('comment_post_forbidden', $node);
    $links['comment_forbidden']['html'] = TRUE;
  }
  return theme('links', $links, array(
    'class' => 'forum-links',
  ));
}