View Full Version : Doublepost = Not counted in user's post count
Austin Dea
08-22-2002, 02:30 PM
We all know that sometimes there is a need to post a couple times in a row, whether it be multiple attachments, posting updates, etc. This hack will make it so that the double/triple/whatever post is not added to the user's post count, but still shown and updated in the forum and thread count. I kow at some boards there is a lot of competition in post counts, and although doubleposting is not looked highly upon in most forums, this would ensure that the user isn't getting any benefit out of it. Plus people could use it for bumping topics, etc, etc, etc. This hack will also make it so if that doublepost is deleted, it will not subtract from the user's postcount. Since it was never added in the first place, it shouldn't be a problem ;).
---------------------------------------------------------------------
NOTE: I did use (with permission) the query and if statement from Xenon's Prevent Doubleposting (https://vborg.vbsupport.ru/showthread.php?s=&threadid=40145) hack.
---------------------------------------------------------------------
This is a simple hack which only involves 2 file edits (editpost.php and newreply.php). And it does work with the QRB =P. If you have any questions, etc, post them here.
DOESN'T WORK.
NTLDR
08-22-2002, 02:33 PM
Nice and v.usefull hack, I think I'll have to install this one ;)
DemiNeo0101
08-22-2002, 02:35 PM
i like this.
/me clicks install
Austin Dea
08-22-2002, 03:35 PM
Aw dangit. Everyone who has installed, please uninstall. It's not counting posts at all for some reason. Let me figure out what's wrong.
Austin Dea
08-22-2002, 04:07 PM
Grrr...this doesn't work. Guess I didn't fully test it. Mods either delete this or move it to Help Me Finish.
Sorry guys...
Austin Dea
08-22-2002, 07:57 PM
Ok, here's what I had. If someone could point out to me why no posts were being added or deleted, even if it wasn't a double post, that'd be great.
Xenon
08-22-2002, 08:03 PM
as i told ya in my pm your part of editpost.php is wrong:
$lastpost = $DB_site->query_first("SELECT * FROM post WHERE threadid = '$threadid' ORDER BY postid DESC");
because the newest post is always the last post of a thread ;)
you must use a query one post before:
$lastpost = $DB_site->query_first("SELECT * FROM post WHERE threadid = '$threadid' AND postid<$postid ORDER BY postid DESC");
i think that should be right...
Austin Dea
08-23-2002, 02:23 AM
Ok thanks. But it's not adding any posts either...
g-force2k2
08-23-2002, 05:20 AM
Austin Dea for the newreply.php fiasco why don't instead of all the other coding (i could be wrong)
just find:
".iif ($foruminfo[countposts],"posts=posts+1,","")."
and replace it with:
".iif ($foruminfo[countposts],"posts=posts+'".iif($threadinfo[lastposter] == "$bbuserinfo[username]",'0','1')."',","")."
That should do the trick O_o regards...
g-force2k2
Xenon
08-23-2002, 10:16 AM
that's because you also have to use dateline, and so on to see if it's really a double post (meant as spam) or just a post after 5 days...
Boofo
08-23-2002, 10:36 AM
So, Then, is this the whole code that will make the hack work right?
Doublepost = Not counted Hack
File edits: 2 (editpost.php, newreply.php)
#################################################
Step 1
#################################################
--------------------------
In editpost.php, find:
--------------------------
deletepost($postid,$foruminfo[countposts],$threadinfo[threadid]);
--------------------------
Replace it with:
--------------------------
// doublepost = no count hack
$lastpost = $DB_site->query_first("SELECT * FROM post WHERE threadid = '$threadid' AND postid<$postid ORDER BY postid DESC");
if($lastpost[userid]!=$bbuserinfo[userid] || (time()-$lastpost[dateline])>3600 || ($attachmentid and !$foruminfo[moderateattach])) {
deletepost($postid,$foruminfo[countposts],$threadinfo[threadid]);
} else {
deletepost($postid,$countposts=0,$threadinfo[threadid]);
}
// end doublepost = no count hack
--------------------------
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#################################################
Step 2
#################################################
--------------------------
In newreply.php, find:
--------------------------
".iif ($foruminfo[countposts],"posts=posts+1,","")."
--------------------------
Replace it with
--------------------------
// doublepost = no count hack
".iif ($foruminfo[countposts],"posts=posts+'".iif($threadinfo[lastposter] == "$bbuserinfo[username]",'0','1')."',","")."
// end doublepost = nocount hack
--------------------------
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Upload the two files and you're done. Enjoy =P.
Xenon
08-23-2002, 10:38 AM
i won't use it now boofo, it's not really tested...
i can think of two more bugs in it i try to found out now ;)
Xenon
08-23-2002, 10:43 AM
ok this is one of another bug in editpost.php, i post just the correct code ;):
// doublepost = no count hack
$lastpost = $DB_site->query_first("SELECT * FROM post WHERE threadid = '$threadid' AND postid<$postid ORDER BY postid DESC");
if($lastpost[userid]!=$bbuserinfo[userid] || ($postinfo[dateline]-$lastpost[dateline])>3600 || $postinfo[attachmentid]) {
deletepost($postid,$foruminfo[countposts],$threadinfo[threadid]);
} else {
deletepost($postid,$countposts=0,$threadinfo[threadid]);
}
// end doublepost = no count hack
ok i think with this editpost.php should work perfect now...
Boofo
08-23-2002, 10:44 AM
Ok, when you have something to test, let me know and I will try it out. :)
Boofo
08-23-2002, 10:46 AM
And the newreply part is ok?
Xenon
08-23-2002, 10:50 AM
you can try the delete function when having a lot of doubleposts ;)
nope, the newreply part is just ok, when you don't use attachments, and regard every doublepost from a user as a real doublepost. (There is no timespan in it that marks a post as real doublepost as it should...)
Boofo
08-23-2002, 10:54 AM
Do you mean the newreply part from Austin Deas code or the newpreply part from g-force2k2?
Boofo
08-23-2002, 10:56 AM
I have 2 instances of this code in the editpost.php. Do I replace both of them?
deletepost($postid,$foruminfo[countposts],$threadinfo[threadid]);
Xenon
08-23-2002, 11:16 AM
??
i just have one instance....
i mean g-forces part has this problems, austins didn't work at all as i know ^^
Boofo
08-23-2002, 11:22 AM
Here is the code I have that has 2 instances of it in the editpost.php.
if ($action=="deletepost") {
// +++++++ Start Checking Delete Post Permissions [ Start ] +++++++
$perms=getpermissions();
if(!$perms[candeleteposts]) {
eval("standarderror(\"".gettemplate("error_cantdeleteposts")."\");");
exit;
}
// +++++++ Start Checking Delete Post Permissions [ End ] +++++++
if ($deletepost=="yes") {
//get first post in thread
$getfirst=$DB_site->query_first("SELECT postid,dateline FROM post WHERE threadid='$threadid' ORDER BY dateline LIMIT 1");
if ($getfirst[postid]==$postid) {
// delete thread
if ($getperms[candeletethread]) {
deletethread($threadinfo[threadid],$foruminfo[countposts]);
updateforumcount($threadinfo[forumid]);
eval("standardredirect(\"".gettemplate("redirect_deletethread")."\",\"forumdisplay.php?s=$session[sessionhash]&forumid=$threadinfo[forumid]\");");
} else {
show_nopermission();
}
} else {
//delete just this post
$foruminfo=getforuminfo($threadinfo[forumid]);
deletepost($postid,$foruminfo[countposts],$threadinfo[threadid]);
updatethreadcount($threadinfo[threadid]);
updateforumcount($threadinfo[forumid]);
eval("standardredirect(\"".gettemplate("redirect_deletepost")."\",\"showthread.php?s=$session[sessionhash]&threadid=$threadinfo[threadid]\");");
}
} else {
eval("standardredirect(\"".gettemplate("redirect_nodelete")."\",\"showthread.php?s=$session[sessionhash]&postid=$postid#post$postid\");");
}
}
if ($action=="deletethispost") {
$firstpost=$DB_site->query_first("SELECT postid,dateline FROM post WHERE threadid='$threadid' ORDER BY dateline LIMIT 1");
if ($postid==$firstpost[postid]) {
if ($getperms[candeletethread]) {
deletethread($threadinfo[threadid],$foruminfo[countposts]);
updateforumcount($threadinfo[forumid]);
$url="forumdisplay.php?s=$session[sessionhash]&forumid=$threadinfo[forumid]";
eval("standardredirect(\"".gettemplate("redirect_deletethread")."\",\"$url\");");
} else {
show_nopermission();
}
} else {
$foruminfo=getforuminfo($threadinfo[forumid]);
deletepost($postid,$foruminfo[countposts],$threadinfo[threadid]);
updatethreadcount($threadinfo[threadid]);
updateforumcount($threadinfo[forumid]);
$url="showthread.php?s=$session[sessionhash]&threadid=$threadinfo[threadid]";
eval("standardredirect(\"".gettemplate("redirect_deletepost")."\",\"$url\");");
}
}
?>
What should I use for the newreply then? If it does have attachments in it, will it work?
Xenon
08-23-2002, 11:28 AM
from a quick delete hack i think? ^^
yes replace both ;)
Boofo
08-23-2002, 11:30 AM
I think that is the hack. :) Now, that leaves the newreply code. :)
Boofo
08-23-2002, 11:46 AM
Xenon, do I need to add the following to the code that you gave me the other day to turn off Double Posting Prevention for this in the editpost, too?
!$stopdoublepost ||
The code for the editpost.php seems to work fine. It incremented my postcount by one for the first post and stayed the same on all the doubleposts. When I deleted them, the count only went down by one. All this was done without adding anything to the newreply.php file at all (because I wasn't sure what code to add). I guess I don't understand why it works that way but it apparently does. :) Do I still need to add any code to the newreply.php then? And will having any attachments to the first post in a double post make any difference?
g-force2k2
08-23-2002, 01:53 PM
Xenon to me any post after another is double posting ;) doesn't matter about the dateline to me... but thats just my opinion...
okay here's another scenario...
Run the query ::
ALTER TABLE thread ADD lastposterid int(10) NOT NULL DEFAULT '0'
open newreply.php
find:
$DB_site->query("UPDATE thread SET lastpost='".time()."',replycount='$replies[replies]',lastposter='".addslashes($postusername)."' WHERE threadid='$threadid'");
} else {
$DB_site->query("UPDATE thread SET lastpost='".time()."',replycount=replycount+1,lastposter='".addslashes($postusername)."' WHERE threadid='$threadid'");
replace with:
$DB_site->query("UPDATE thread SET lastpost='".time()."',replycount='$replies[replies]',lastposter='".addslashes($postusername)."', lastposterid='$postuserid' WHERE threadid='$threadid'");
} else {
$DB_site->query("UPDATE thread SET lastpost='".time()."',replycount=replycount+1,lastposter='".addslashes($postusername)."', lastposterid='$postuserid' WHERE threadid='$threadid'");
find:
".iif ($foruminfo[countposts],"posts=posts+1,","")."
replace with:
".iif ($foruminfo[countposts],"posts=posts+'".iff($threadinfo[lastposterid] == "$bbuserinfo[userid]" AND ((time() - $threadinfo[lastpost]) / 86400) > 5,'0','1')."' ,","")."
haven't tested the code... but it may work ;) regards...
g-force2k2
Austin Dea
08-23-2002, 02:03 PM
O_O....
I had no idea I was so far off >_<...
Xenon
08-23-2002, 05:39 PM
boofo: yes i think you have to add this ;)
g-force: what about two posts but every post has an attachment in it? ;)
that's why i have so much if-clauses ;)
but without attachments it'll work perfect, so at my forums i could use this code :)
Boofo
08-23-2002, 06:00 PM
ok, I will need to add what now? I am confused. I need to add the stopdoublepost to the editpost lines (both of them)? And what about newreply.php? Which code do I need to add there? And it will take care of attachment problems? Sorry to sound so stupid on this one but I want to make SURE I have it right. (After all, we both know what happens when I mess up...i.e. the time thing yesterday?) :)
Xenon
08-23-2002, 06:12 PM
add the stopdoublepost everywhere...
no the modification from g-force won't take care of attachments...
or let's say also two posts just with different attachments are called doublepost for him, so yes it'll work ;)
Boofo
08-23-2002, 06:16 PM
Ok, so is there a way around the attachment issue in Double posting? Maybe have it so it won't allow attachments when it double posts or something? Should I use his code for the newreply then or do we still need anything in the newreply file?
Austin Dea
08-23-2002, 06:17 PM
I tried g-force's thing and when I submit a rpely in the qrb is says something about an uncdefined funtion iif(), but then when I refresh or go back and do it again it works...
Xenon
08-23-2002, 06:18 PM
you can use it, but it's not perfect ;)
or as g-force said: not perfect in MY opinion ;)
Austin Dea
08-23-2002, 06:19 PM
I don't think dates and stuff should matter. By double posting, I mean just that someone has two posts in a row. Not they clicked the link twice or whatever.
Boofo
08-23-2002, 06:27 PM
Ok, but do I need it? Do I need anything in the newreply.php? Will the hack work ok for the count without it? I think I have a way of taking care of the attachment problem. I just won't allow you to add an attachment if it is a double post. Will that work?
Originally posted by Xenon
you can use it, but it's not perfect ;)
or as g-force said: not perfect in MY opinion ;)
Xenon
08-23-2002, 06:32 PM
yes it'll work
no you don'T NEED some extra changes to newreply.php after using g-forces ;)
Austin Dea
08-23-2002, 06:39 PM
Well, part of the point of this hack was to make it so people could do multiple attachments, only without adding onto their post count.
Xenon
08-23-2002, 06:45 PM
then you should take out the attachement conditions from my editpost.php part ;)
Austin Dea
08-23-2002, 06:45 PM
Why would this not work?
$postcounted="";
if ($threadinfo[lastposterid]!=$bbuserinfo[userid]) {
$postcounted="1";
} else {
$postcounted="0";
}
$DB_site->query("UPDATE user SET
".iif ($foruminfo[countposts],"posts=posts+$postcounted,","")."
$dotitle"."lastpost='".time()."' WHERE userid='$bbuserinfo[userid]'");
Instead of the iif()'s g-force had.
Boofo
08-23-2002, 06:47 PM
g-force2k2, this is the line I have in my newreply.php that I need to replace.
".iif ($foruminfo[countposts], incrementposts($bbuserinfo['userid']), '')."
How do I replace it with the following?
// doublepost = no count hack
".iif ($foruminfo[countposts],"posts=posts+'".iif($threadinfo[lastposter] == "$bbuserinfo[username]",'0','1')."',","")."
// end doublepost = nocount hack
Xenon
08-23-2002, 06:48 PM
it would work, but iif looks better ;)
Austin Dea
08-23-2002, 08:42 PM
Originally posted by Boofo
g-force2k2, this is the line I have in my newreply.php that I need to replace.
".iif ($foruminfo[countposts], incrementposts($bbuserinfo['userid']), '')."
How do I replace it with the following?
// doublepost = no count hack
".iif ($foruminfo[countposts],"posts=posts+'".iif($threadinfo[lastposter] == "$bbuserinfo[username]",'0','1')."',","")."
// end doublepost = nocount hack
Is incrementposts() a functions in your functions.php? If so, you'd need to edit that function...
Boofo
08-23-2002, 08:46 PM
Increments is for the hack that allows you to make a users post count go backwards instead of forward. :)
Originally posted by Austin Dea
Is incrementposts() a functions in your functions.php? If so, you'd need to edit that function...
Austin Dea
08-23-2002, 09:07 PM
Ok, I have it now. If you use g-force's first edit to newreply.php (post#9) and Xenon's editpost.php edit (post#13) it works perfectly. Thanks again guys. I really learned a lot from this whole 'fiasco' as g-force put it. I'll put this in Full release, but all the credit totally goes to you g-force2k2 and you Xenon.
Boofo
08-23-2002, 09:10 PM
It works perfect for me without adding the code for the newreply.php. :)
Originally posted by Austin Dea
Ok, I have it now. If you use g-force's first edit to newreply.php (post#9) and Xenon's editpost.php edit (post#13) it works perfectly. Thanks again guys. I really learned a lot from this whole 'fiasco' as g-force put it. I'll put this in Full release, but all the credit totally goes to you g-force2k2 and you Xenon.
Austin Dea
08-23-2002, 09:20 PM
But wouldn't that keep adding the posts?
Also, I don't understand what the attachment problem is. :confused:
Boofo
08-23-2002, 09:26 PM
It didn't when I did a bunch of double posts. It only added 1 post count for the first one and no more for any double posts after that. And when I deleted them all it only took the post count down by 1. It has me curious, too. :) But isn't a double post basically just editing the message that is already there?
The attachment thing, I have no idea what Xenon means with that. But if he brought it up, then it must mean something, somewhere. :)
Originally posted by Austin Dea
But wouldn't that keep adding the posts?
Also, I don't understand what the attachment problem is. :confused:
Austin Dea
08-23-2002, 09:29 PM
I think you guys are thinking of doublepost to literally. I just mean multiple posts in a row in a thread by the same user.
Austin Dea
08-23-2002, 09:33 PM
Ok, I tried it with just the editpost.php edit and it kept raising my post count =P. What was odd though was that if I typed the exact same message and hit submit, it would go to the redirect thing, but the post wasn't there...o_O
Austin Dea
08-23-2002, 09:57 PM
Ok, here's are my instrucs. I edited your chunk Xenon since I thought the time didn't matter and you said to make attachments work (although I never saw what was wrong with them) to take that part out.
In newreply.php find:".iif ($foruminfo[countposts],"posts=posts+1,","")."
Reaplce it with (code by g-force2k2)".iif ($foruminfo[countposts],"posts=posts+'".iif($threadinfo[lastposter] == "$bbuserinfo[username]",'0','1')."',","")."
In editpost.php, find:deletepost($postid,$foruminfo[countposts],$threadinfo[threadid]);
Raplce it with (code by Xenon):// doublepost = no count hack
$lastpost = $DB_site->query_first("SELECT userid,postid FROM post WHERE threadid = '$threadid' AND postid<$postid ORDER BY postid DESC LIMIT 1");
if ($lastpost[userid]!=$bbuserinfo[userid]) {
deletepost($postid,$foruminfo[countposts],$threadinfo[threadid]);
} else {
deletepost($postid,$countposts=0,$threadinfo[threadid]);
}
// end doublepost = no count hack
Works perfectly =P.
Boofo
08-23-2002, 10:40 PM
I am going by the meaning of double Posting like Xenon meant in his hack. I have it set to one hour right now but it can be adjusted. I also have an addon that will turn double posting prevention off altogether (for testing purposes or what not). This is all I want this hack for. The rest of the time, it really doesn't matter. The spamming is what I want to avoid. So, you do it for ALL double posts and I will try to come up with something to compliment Xenon's hack. :)
Austin Dea
08-23-2002, 11:20 PM
Ok. My original intention was just to have it so multiple posts by the same person would not effect their postcount.
Again I'd like to say thanks to Xenon and g-force2k2, and you guys get full credit for the hack :).
Xenon
08-24-2002, 12:14 AM
you know we like to help ;)
and to explain what i meant with attachment problem:
in my doublepost hack, if a user posts two posts in row and both contains attachments then the posts wouldn't be merged as it would be when none of the posts has an attachment ;)
it was never a problem, i just mentioned, because at first you used my codeline and have also included the attachment stop. ;)
Boofo
08-24-2002, 12:20 AM
How do we get thos to work with your Prevent Double Post hack? What code do we use for that?
Originally posted by Xenon
you know we like to help ;)
and to explain what i meant with attachment problem:
in my doublepost hack, if a user posts two posts in row and both contains attachments then the posts wouldn't be merged as it would be when none of the posts has an attachment ;)
it was never a problem, i just mentioned, because at first you used my codeline and have also included the attachment stop. ;)
g-force2k2
08-24-2002, 01:27 AM
O_o damn i missed alot :P lol
anways Boofo i think that would require multiple attachments per post and im not sure on that one ;)
g-force2k2
Boofo
08-24-2002, 02:03 AM
I guess all I really want to know is exactly what code I need to work with Xenon's Double post hack. :) I am totally confused now. :)
Originally posted by g-force2k2
O_o damn i missed alot :P lol
anways Boofo i think that would require multiple attachments per post and im not sure on that one ;)
g-force2k2
g-force2k2
08-24-2002, 02:09 AM
Boofo i think you're just suppose to use the coding that his hack includes... the only thing about his hack as that if there's multiple attachments it will disregard of one i believe... or at least thats what i got from what he said ;)
g-force2k2
Boofo
08-24-2002, 02:13 AM
I know, but his hack didn't include the not counting posts I don't think, did it? :)
Originally posted by g-force2k2
Boofo i think you're just suppose to use the coding that his hack includes... the only thing about his hack as that if there's multiple attachments it will disregard of one i believe... or at least thats what i got from what he said ;)
g-force2k2
g-force2k2
08-24-2002, 02:44 AM
no Boofo it didn't... but instead Xenon's hack merged the posts so infact a double post would never exist... but not sure if he used a time limit in his hack?
g-force2k2
Boofo
08-24-2002, 02:46 AM
Ok, well, I guess I don't really need this one then. :) You can set the time limit for stopping double posts with his hack.
Originally posted by g-force2k2
no Boofo it didn't... but instead Xenon's hack merged the posts so infact a double post would never exist... but not sure if he used a time limit in his hack?
g-force2k2
Xenon
08-24-2002, 11:18 AM
correct, this two hacks can hardly be used together ;)
it depends on every admins opinion which one he likes more...
Boofo
08-24-2002, 12:19 PM
Sorry, Stefan, I didn't realize that your hack didn't add postcounts to Double Posts. I don't understand enough of this php stuff yet to sypher it all out. Sorry for making you have to put up with my nonsense. :)
Originally posted by Xenon
correct, this two hacks can hardly be used together ;)
it depends on every admins opinion which one he likes more...
Xenon
08-24-2002, 12:24 PM
no problem, as long as we could solve it before i'm away it's no problem ;)
the two differences in this hacks:
My Hack prevents doubleposting so you can just have one post in a row (except attachments or time...) so postcounter just gets up one time
Austins Hack allows double posting, but it's not counted to the postcount so doubleposting to increase post counts (called spamming ;)) isn't possible ;)
Boofo
08-24-2002, 12:35 PM
Spamming isn't possible with yours during the preset time, though, right? BTW: What is the maximum limit on time for your hack? How far into the future can it be set? Might not be a bad idea to have a permanent time option for it, too. :)
Originally posted by Xenon
no problem, as long as we could solve it before i'm away it's no problem ;)
the two differences in this hacks:
My Hack prevents doubleposting so you can just have one post in a row (except attachments or time...) so postcounter just gets up one time
Austins Hack allows double posting, but it's not counted to the postcount so doubleposting to increase post counts (called spamming ;)) isn't possible ;)
Xenon
08-24-2002, 12:39 PM
the maximum timeperiod of my hack is also the maximum of unix-timestamp, so it was Year 2037 wasn't it?
if you set it up to that time, spamming isn't possible anymore ;)
just if they use attachments or they are building spam teams ;)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.