function advanced_forum_get_reply_link in Advanced Forum 6.2
Same name and namespace in other branches
- 7.2 advanced_forum.module \advanced_forum_get_reply_link()
1 call to advanced_forum_get_reply_link()
- theme_advanced_forum_reply_link in includes/
theme.inc - Theme function to format the reply link at the top/bottom of topic.
File
- ./
advanced_forum.module, line 811 - Enables the look and feel of other popular forum software.
Code
function advanced_forum_get_reply_link($node) {
$reply_link = array();
// Give nodecomment (if installed) first shot at the comment setting
$comment_setting = empty($node->node_comment) ? $node->comment : $node->node_comment;
// Anchor to the form is depends on if reply is a node or a comment.
$fragment = empty($node->node_comment) ? 'comment-form' : 'node-form';
if ($comment_setting == COMMENT_NODE_READ_WRITE) {
if (advanced_forum_user_can_reply($node)) {
if (variable_get('comment_form_location_' . $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
// Reply form is on separate page. Grab the href from the node links
// so it's automatically corrected for Node Comments if needed.
$reply_link['href'] = $node->links['comment_add']['href'];
$reply_link['options']['fragment'] = $fragment;
$reply_link['class'] = 'reply-allowed';
$reply_link['title'] = t('Post reply');
return $reply_link;
}
else {
// Reply form is on same page. The reply button should jump down to it
// rather than going to a new page.
$reply_link['href'] = $_GET['q'];
$reply_link['options']['fragment'] = $fragment;
$current_page = isset($_GET['page']) ? $_GET['page'] : 0;
$reply_link['options']['query'] = $current_page ? "page={$current_page}" : NULL;
$reply_link['class'] = 'reply-allowed';
$reply_link['title'] = t('Quick reply');
return $reply_link;
}
}
else {
// User does not have access to post replies on this node.
return 'reply-forbidden';
}
}
else {
// Topic is locked.
return 'reply-locked';
}
}