Thread: Show Thread Enhancements - Answer Forums 1.0.0
View Single Post
  #251  
Old 06-29-2010, 09:43 PM
basketmen's Avatar
basketmen basketmen is offline
 
Join Date: Nov 2006
Posts: 446
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

(In forumdisplay) Top helpers by each forum, not Top helpers from all forum




Please help how to make Top Helpers on forumdisplay will showing Top helpers by each forum, not Top helpers from all forum, thats how looks like yahoo answer



like this health category in yahoo answer, and the top contributor


Science and mathematics category





please can you make little edit just for that or give a clue, we really need it to make like yahoo answer



i believe its in 'Answer Forums - Transform Forumdisplay' plugin

i already try add the red code below (The Top Helpers part code), by looking the code in blue (The stats code is by each forum, not all forum)

but its not right, get error, please help or give a clue to make this work, this is to make this mod better, like yahoo answer







Quote:
if($foruminfo[g_answer_forum]){

// Set cutoff date if once is applied
$af_cutoff = $vbulletin->options['answers_forums_cutoff_date'];

// Filter answers?
if($_REQUEST['show_answers'] == '1'){
$hook_query_where .= " AND thread.g_answer_forum_answer != '0' AND thread.dateline > '" . $af_cutoff . "'";
} elseif($_REQUEST['show_answers'] == '0'){
$hook_query_where .= "AND thread.g_answer_forum_answer = '0' AND thread.dateline > '" . $af_cutoff . "'";
}

// Stats
if($vbulletin->options['answers_forums_enable_stats']){
// An option is enabled, so show the right column
$show[right_column] = 1;

$total_answers = $vbulletin->db->query_first("SELECT count(threadid) AS total FROM " . TABLE_PREFIX . "thread WHERE forumid = " . $foruminfo['forumid'] . " AND g_answer_forum_answer != '0'");
$total_not_answered = $vbulletin->db->query_first("SELECT count(threadid) AS total FROM " . TABLE_PREFIX . "thread WHERE forumid = " . $foruminfo['forumid'] . " AND g_answer_forum_answer = '0' AND dateline > '" . $af_cutoff . "'");

if(!$total_not_answered['total']){ $total_not_answered['total'] = 0; }
$answers_forum['total_answered'] = $total_answers['total'];
$answers_forum['total_not_answered'] = $total_not_answered['total'];

if($total_answers['total']){

$answers_forum['total_answered_percent'] = round($total_answers['total'] / ($total_answers['total'] + $total_not_answered['total']) * 100);

} else {

$answers_forum['total_answered_percent'] = 0;

}
}

// Recently Answered
if($vbulletin->options['answers_forums_enable_recently_answered']){
// An option is enabled, so show the right column
$show[right_column] = 1;

// Recently answered questions
$answered_threads = $vbulletin->db->query_read("SELECT thread.threadid, thread.title, post.dateline, thread.postuserid, thread.postusername, answer_post.userid AS answer_userid, answer_post.username AS answer_username
FROM " . TABLE_PREFIX . "thread AS thread
LEFT JOIN " . TABLE_PREFIX . "post as post ON(post.postid = thread.lastpostid)
LEFT JOIN " . TABLE_PREFIX . "post as answer_post ON(answer_post.postid = thread.g_answer_forum_answer)
WHERE forumid = " . $foruminfo['forumid'] . " AND g_answer_forum_answer != '0' AND thread.dateline > '" . $af_cutoff . "'
ORDER BY post.dateline DESC
LIMIT 15
");

while($thread = $vbulletin->db->fetch_array($answered_threads)){
eval('$answers_forum_threads .= "' . fetch_template("answer_forums_answeredbit") . '";');
}
}

// Top helpers
if($vbulletin->options['answers_forums_enable_top_helpers']){
// An option is enabled, so show the right column
$show[right_column] = 1;

// Users with most answers IE: Our Top Helpers
$top_helpers_get = $vbulletin->db->query_read("SELECT userid, username, forum_answers FROM " . TABLE_PREFIX . "user WHERE forumid = " . $foruminfo['forumid'] . " ORDER BY forum_answers DESC LIMIT 10");

while($helper = $vbulletin->db->fetch_array($top_helpers_get)){
eval('$top_helpers .= "' . fetch_template("answer_forums_helperbit") . '";');
}
}

// Any enabled features to show?
if($show[right_column]){

// Wrap the forumdisplay with the new info
eval('$header .= "' . fetch_template("answer_forums_head") . '";');
eval('$answer_forums_foot .= "' . fetch_template("answer_forums_foot") . '";');
$footer = $answer_forums_foot . $footer;

}

}
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01072 seconds
  • Memory Usage 1,800KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete