View Full Version : Thread count
adielsh
09-11-2005, 11:59 AM
Hello
I need mod that show in the profil hiw mach Thread (not post) the user have
can someone help?
Andreas
09-16-2005, 05:10 AM
SELECT COUNT(*) FROM thread WHERE postuserid=$userinfo[user]
That's it - basically.
Just wrap it in a few Bits of PHP to format it nicely, put the Variable in Template MEMBERINFO and you're done.
Note: This does not care for deleted or moderated Threads. If you don't want to count them a few more conditions are required for the query.
dodgechargerfan
09-16-2005, 08:29 PM
I came looking for something like this.
But I think I'm in over my head.
I want to display a particular thread count on the forum index - forumhome I guess it's called.
I'm new to php. I can follow someone's code and figure out what it does and modify it to suit my needs, but I can't really start my own.
Could I impose on you or someone else to supply an example?
Much appreciated.
Andreas
09-17-2005, 04:51 AM
I want to display a particular thread count on the forum index - forumhome I guess it's called.
What does that mean: The amount of Threads in a specific Forum, the amount of replies in an specific Thread, or smth. completely different?
dodgechargerfan
09-17-2005, 06:14 PM
Sorry, I guess I was vague because I understand how the query should look from your earlier post.
The part I'm having trouble with is the code to make it all show up on a page..
Anyway, what I would like to be able to do is have something that says, "There are ## open posts in the XYZ forum."
And have that placed somewhere just under the navbar...
but once I see the code, I'll know how to move it where I need it - or at least I'll figure it out - eventually... :)
I went and looked through code to see how things are "printed to the screen" but got lost... is it the show command?
Time for some php lessons I guess...
Thanks again for any help.
oh, and the query I'm thinking I will need is:
SELECT COUNT(*) FROM thread WHERE forumid=## AND open=1
Where ## is the forum id number of interest.
Is that close?
Marco van Herwaarden
09-17-2005, 06:23 PM
In php (put it in a plugin):
$mydata = $vbulletin->db->query_first("SELECT COUNT(*) AS mycount .........");
Then you can put in a template:
$mydata[mycount]
PS Showing somehting in php is done with 'echo' or '*print*'
dodgechargerfan
09-17-2005, 10:39 PM
Thanks, this helps a lot.
I'm pretty good at figuring out the behind the scenes system stuff, but as soon as I have to format something for output... I get lost.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.