vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Doublepost = Not counted in user's post count (https://vborg.vbsupport.ru/showthread.php?t=42611)

Austin Dea 08-22-2002 02:30 PM

Doublepost = Not counted in user's post count
 
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 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

1 Attachment(s)
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:

PHP Code:

$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:
PHP Code:

$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:

PHP Code:

          ".iif ($foruminfo[countposts],"posts=posts+1,","")." 

and replace it with:

PHP Code:

        ".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?

Code:

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 ;):

PHP 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?

Code:

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.

Code:

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?

Code:

!$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 ::
PHP Code:

ALTER TABLE thread ADD lastposterid int(10NOT NULL DEFAULT '0' 

open newreply.php

find:

PHP Code:

          $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:

PHP Code:

          $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:

PHP Code:

          ".iif ($foruminfo[countposts],"posts=posts+1,","")." 

replace with:

PHP Code:

          ".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?

Quote:

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?

PHP Code:

        $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.

Code:

".iif ($foruminfo[countposts], incrementposts($bbuserinfo['userid']), '')."
How do I replace it with the following?

Code:

// 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

Quote:

Originally posted by Boofo
g-force2k2, this is the line I have in my newreply.php that I need to replace.

Code:

".iif ($foruminfo[countposts], incrementposts($bbuserinfo['userid']), '')."
How do I replace it with the following?

Code:

// 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...


All times are GMT. The time now is 02:46 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01316 seconds
  • Memory Usage 1,865KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (8)bbcode_code_printable
  • (11)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete