The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Count number of search results
Hi is there a way for me to be about to count the number of search results returned from a searchJSON to pass into a variable that I can display to users.
I'm trying to do this as a way to display post counts each user has in a specific topic and this is where I am stuck. Any help would be amazing. Code:
<a href="{vb:url 'search'}?searchJSON=%7B%22author%22:%22{vb:raw conversation.authorname}%22,%22exactname%22:%221%22,%22channel%22:[{vb:raw conversation.nodeid}]%7D">[ISO {vb:raw conversation.authorname}]</a> <vb:else /> <a href="{vb:url 'search'}?searchJSON=%7B%22author%22:%22{vb:raw conversation.authorname}%22,%22exactname%22:%221%22,%22channel%22:[{vb:raw conversation.parentid}]%7D">[ISO {vb:raw conversation.authorname}]</a> </vb:if> |
#2
|
||||
|
||||
Im not good with json, or vb4 for that matter, but I literally JUST finished making a product that one of the features is grabbing the count of post a user has made in a thread. So if its of any help, or gets you in the right direction take a look at this product for vb4 that is able to pull post count of a user in a thread (its what i just used as my vb3 base). hopefully it will help.
https://vborg.vbsupport.ru/showthread.php?t=285293 |
#3
|
|||
|
|||
Thanks, unfortunatly with vb5 they got rid of some of the critical pieces that made the old way this was done. One of them being in the admincp/misc.php as well as changing what a "thread" is and restructuring the forum so that its easier to store in the database without bogging it down.
https://vbulletin.org/forum/showthread.php?t=328571 Thats why I'm trying to find different ways to go about solving this. I appreciate the quick response tho. --------------- Added [DATE]1647223560[/DATE] at [TIME]1647223560[/TIME] --------------- Owell you have inspired me tho I do need to get out of my comfort zone and try another strategy and get into building something more significant. Code:
{class TalonThreadPostCount_dB_MYSQL_QueryDefs extends vB_dB_QueryDefs { protected $db_type = 'MYSQL'; protected static $permission_string = false; protected $query_data = array ( 'getUserThreadPostCount' => array( vB_dB_Query::QUERYTYPE_KEY => vB_dB_Query::QUERY_SELECT, 'query_string' => " SELECT COUNT from {TABLE_PREFIX}node Where userid = {userid} AND parentid = {parentid} " ), ); } |
#4
|
||||
|
||||
I would do that directly in a new template and do a search via the API search, getInitialResults.
Then you get an array containing all the required values. Also the number of posts. Just look at the templates for an example: widget_blognodes widget_search_results ..and use debugvardump to get dump of the array. Edit: Your query is not taking care of any permission or closed status. The search will ... |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|