PDA

View Full Version : {{[REQUEST]}} Add PM count to post count


Fred
08-12-2001, 04:04 AM
How can I add the person's pm count to their post count. And then add all the pm count to the total post count at the top??

Could someone please help me with this. I've been asking for months and still no help!

snyx
08-12-2001, 04:12 AM
I see NO point for it man?

Fred
08-12-2001, 03:43 PM
My posters want it. So how do I do it?

Sarge
08-13-2001, 02:49 PM
Man!
I have been requesting this for 6 months!
I want it added to the post count on the top of the forums and added to each persons post count

Anyone interested?!

Fred
08-14-2001, 07:01 PM
same. i need it

Sarge
08-15-2001, 05:33 PM
Dear Jesus,
Please encourage a kind soul try and hack this one.
Thank you for this sandwich I am about to eat.
God bless you amen

DjSao
08-15-2001, 06:50 PM
Well i did this before, i just added code that incresed post count by 1 every time you sent a pm. Is this what you are lookin for?

Sarge
08-15-2001, 07:37 PM
yeah that woruld rock
Is there anyway we can count old pm's also?

BDJ
08-15-2001, 07:51 PM
Well, I don't know about old private messages, but the new ones should be easy enough to do.
Try adding this code to the private.php file (right after the INSERT command for a PM).


$DB_site->query("UPDATE user SET posts=posts+1 WHERE userid=$bbuserinfo[userid]");

Fred
08-15-2001, 08:45 PM
WE need the old ones too.. Any idea how to put that in there?

BDJ
08-15-2001, 09:13 PM
Hmm...there's maybe a really non-server intensive way to do it...but i don't know it.
;)

maybe create a script like this..

drop this in your vB directory...


<?php

include('./global.php');

$users = $DB_site->query("SELECT userid,posts FROM user");


while ($userrow = $DB_site->fetch_array($users)) {
$pm = $DB_site->query("SELECT count(*) FROM privatemessage WHERE fromuserid=$userrow[userid] AND folderid>=0");
$pmcount = mysql_result ($pm,0);
$update = $DB_site->query("UPDATE user SET posts=posts+$pmcount WHERE userid=$userrow[userid]");
}

?>


Try running that and see if it works - maybe not the most efficient code or anything..but it might work
;)

Sarge
08-16-2001, 12:34 AM
Originally posted by BDJ
Well, I don't know about old private messages, but the new ones should be easy enough to do.
Try adding this code to the private.php file (right after the INSERT command for a PM).


$DB_site->query("UPDATE user SET posts=posts+1 WHERE userid=$bbuserinfo[userid]");






Can you give me the line where to insert this?
I added it and it didn't work "Probably added it in the wrong place"

Version 2.0.0

BDJ
08-16-2001, 02:51 AM
look under the section that starts with

if ($HTTP_POST_VARS[action] == 'dosend')

then, go down a little bit and you'll see a line that starts like this:
$DB_site->query("INSERT INTO privatemessage....

then,just insert that line of code after that.

(if it doesn't work - tell me; i'll test it out on my system. Right now, this is all from my head - don't know if it'll actually work)

Sarge
08-16-2001, 03:47 AM
does not work

here is what i added

// enhanced - added $receipt to insert
$DB_site->query("INSERT INTO privatemessage (privatemessageid,userid,touserid,fromuserid,title ,message,dateline,showsignatur e,iconid,messageread,folderid,receipt) VALUES (NULL,$touserinfo[userid],$touserinfo[userid],$bbuserinfo[userid],'".addslashes(htmlspecialchars($title))."','".addslashes($message)."',".time(). ",'$signature','$iconid',0,0,$receipt)");
$DB_site->query("UPDATE user SET posts=posts+1 WHERE userid=$bbuserinfo[userid]");
// enhanced

Sarge
08-16-2001, 03:48 AM
200 posts WHOOAH!

Any clues dude?

BDJ
08-16-2001, 07:19 AM
I don't know dude...I just installed it on my system and it worked fine..

hmmmm
:confused:

Sarge
08-16-2001, 01:20 PM
did you install it in the same place as me?
Where I cut and pasted?

BDJ
08-16-2001, 03:22 PM
yep.

Sarge
08-16-2001, 05:50 PM
doesn't work for me at all

Fred
08-18-2001, 01:40 AM
Ed Sullivan, I know you can do this. Can you help us out?