The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
first post counted as reply in custom script
I am working on building a classifieds section on my forum and the current code is counting the first post of a thread as a reply. is there a way around this? Here is my current code
Code:
$cats = array(18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68); foreach ($cats AS $cat => $forumid) { $t_count[$forumid] = array( "forumid" => $forumid, "forum_name" => $vbulletin->forumcache[$forumid]['title'], "threadcount" => vb_number_format($vbulletin->forumcache[$forumid]['threadcount']), "replycount" => vb_number_format($vbulletin->forumcache[$forumid]['replycount']) ); } foreach ($cats AS $cat) { $total_count_thread += vb_number_format($vbulletin->forumcache[$cat]['threadcount']); $total_count_reply += vb_number_format($vbulletin->forumcache[$cat]['replycount']); } $classifieds = array_merge($t_count); if (is_member_of($vbulletin->userinfo, 6)) { /* print_r($total_count_reply); echo "<br />"; print_r($total_count_thread); */ } vB_Template::preRegister('FORUMHOME',array('classifieds' => $classifieds)); vB_Template::preRegister('FORUMHOME',array('total_count_thread' => $total_count_thread)); vB_Template::preRegister('FORUMHOME',array('total_count_reply' => $total_count_reply)); https://www.thesecond.org/forum/#classifieds if i make a "classified" aka thread, my "Listings" and "Replies" count is 1 when I'd like it to be Listings: 1 Replies: 0 Hope that makes sense. Thanks in advance! |
#2
|
|||
|
|||
It looks like the forum replycount is the number of posts including the first in each thread. But it seems like you should be able to get what you want by subtracting the threadcount from the replycount.
By the way, that's a very cool map you have there. |
#3
|
||||
|
||||
Thanks! yeah, I cant remember, but does default vB4 in a brand new forum, when a new thread is made with its only post, does it show as 1 thread 1 reply, or 1 thread 0 replies ?
|
#4
|
|||
|
|||
I just made a new forum on my test site to check and it looks like the thread replycount field counts only replies after the first, but the forum replycount field (which it looks like you're using in the code you posted) counts every post including the first. So in my new forum (with one thread with only the first post), when I'm looking at it in the list of forums it shows 1 Thread and 1 Post, but when I list the threads in the forum, that thread shows 0 replies.
|
Благодарность от: | ||
LifesGreatestGift |
#5
|
||||
|
||||
Awesome. Thanks! The Threads minus Replies is a really good idea. I will implement that! Thanks again! And congrats on the mod position.
--------------- Added [DATE]1360032320[/DATE] at [TIME]1360032320[/TIME] --------------- * Replies minus Threads --------------- Added [DATE]1360033677[/DATE] at [TIME]1360033677[/TIME] --------------- Here is the new revised code for anyone wondering Code:
$cats = array(18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68); foreach ($cats AS $cat => $forumid) { $t_count[$forumid] = array( "forumid" => $forumid, "forum_name" => $vbulletin->forumcache[$forumid]['title'], "threadcount" => vb_number_format($vbulletin->forumcache[$forumid]['threadcount']), "replycount" => vb_number_format(($vbulletin->forumcache[$forumid]['replycount']) - ($vbulletin->forumcache[$forumid]['threadcount'])) ); } foreach ($cats AS $cat) { $total_count_thread += vb_number_format($vbulletin->forumcache[$cat]['threadcount']); $total_count_reply += vb_number_format(($vbulletin->forumcache[$cat]['replycount']) - ($vbulletin->forumcache[$cat]['threadcount'])); } $classifieds = array_merge($t_count); if (is_member_of($vbulletin->userinfo, 6)) { /* print_r($total_count_reply); echo "<br />"; print_r($total_count_thread); */ } vB_Template::preRegister('FORUMHOME',array('classifieds' => $classifieds)); vB_Template::preRegister('FORUMHOME',array('total_count_thread' => $total_count_thread)); vB_Template::preRegister('FORUMHOME',array('total_count_reply' => $total_count_reply)); |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|