The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Contradicting post count
Hoping some of you great folk can assist me with this little problem I have.
We've added a profile popup to our forum for which we are calling the content from the mysql database which is working fine but it's causing a contradiction in the post count on postbit_legacy as it's including all the spam threads as well for which posts don't count. Is there anyway I can exclude these forum id's from the .php file so it only reads the correct postcount The code to grab the postcount.php is as follows; Code:
$grabposts = mysql_query("SELECT * FROM post WHERE userid = '" . $userid . "'"); $showposts = mysql_fetch_assoc($grabposts); $numposts = mysql_num_rows($grabposts); $postsamount = number_format($numposts); Thanks, JB |
#2
|
||||
|
||||
Why not just use the post count that is attached to the users profile, which will usually be accessible from, or made accessible from all locations. It will be a much faster query because you aren't going through the entire post table to search for things, and likely won't need any additional queries to make it work and it will automatically exclude all forums that don't contribute to post count.
If you really want to query the post table then use this code as it's better than what you have: Code:
$grabposts = mysql_query_first("COUNT * AS posts FROM post WHERE userid = '" . $userid . "' AND forumid NOT IN (forumid1, forumid2, . . . .)"); $numposts = $grabposts['posts']; $postsamount = number_format($numposts); |
4 благодарности(ей) от: | ||
CAG CheechDogg, LethalJ, Lynne, MarkFL |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|