PDA

View Full Version : total member replies in one thread


Mr_P
11-05-2002, 11:00 PM
I'm unsure if this is a hack request , or simply a php issue

I need a query that will assign a variable to the total number of replies a member has made in that thread.

I want to put a entry in the postbit so that you can see how many replies the member has posted in that thread.

Not a rolling total, just the total, so if he posted 4 replies to that thread, you will see "4 replies" in the postbit on everyone post he makes in that thread.

Is this possible with a query ?

Thanks for all assistance given ;)

filburt1
11-05-2002, 11:38 PM
SELECT COUNT(*) FROM post WHERE userid=$userid AND threadid=$threadid

Erwin
11-06-2002, 12:16 AM
Be aware that is one query per post per thread. That can add up.

filburt1
11-06-2002, 12:19 AM
I don't know why you'd want it in the first place, there's the Who Posted? popup...

Mr_P
11-06-2002, 05:32 PM
Thank-you for your comments and help. but

ok, where do I put this ??

Would it make any difference if I were to say I only really need this variable assigning if the member has more than X ammount of replies ( replies not starting post ) in that thread.

I want to be able to look at a thread and see who are the main contributors to that thread.

I could use logican's template hack so that the postbit changes dependant on how many replies they have.

So I could say hard code a value of say 10

I would then be able to easily see which members had 10 replies to that thread and it would be obvious to the main contributers.

Hope this makes sense

Logician
11-06-2002, 08:40 PM
Here you go..

And it's optimized so that it wont add a SQL query per post. It just adds 1 query for thread in thread view (which is inevitable)..

Enjoy..

Mr_P
11-06-2002, 08:49 PM
stunning m8, thanks m8

I'll give it a whirl and let you know how i get on.

Once again thanks

Erwin
11-07-2002, 09:17 AM
Logician to the rescue once again... ;)

Mr_P
11-07-2002, 07:22 PM
He sure was

Its works a treat, and yes only one more query

I do have one further query though, Can this now be used with your dynamic templates hack ?

[[($post[howmanypost]>10])]]
Major Thread Contributor
[[/($post[howmanypost]>10])]]

Would this be correct ?

Logician
11-07-2002, 10:36 PM
Originally posted by Mr_P
[[($post[howmanypost]>10])]]
Major Thread Contributor
[[/($post[howmanypost]>10])]]

Would this be correct ?
Provided that you apply the hacks (both this one and advanced templates) first and insert this to postbit template, yep that's correct! :)

If you want to apply the modification in the hack code (so as not to need advanced templates hack), find:


$post[howmanypost]=(int)$howmany_userposts[$mypost_userid];


After it Add this:


if ($post[howmanypost]>10) {$post[howmanypost]="Major Thread Contributor";
else {$post[howmanypost]='';}


it will give the same result with the conditional you referred..