Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Prevent Doubleposting Details »»
Prevent Doubleposting
Version: 1.6, by Xenon Xenon is offline
Developer Last Online: Oct 2023 Show Printable Version Email this Page

Version: 3.0.6 Rating:
Released: 01-07-2004 Last Update: 02-05-2005 Installs: 288
Code Changes  
No support by the author.

When a User posts into a thread where he already has the lastpost, no new post will be added. The lastpost of him will be edited and the new text is put after his first message, attachments will be added to the old post as well.
This will be done until the old post is older than 1 hour (you can change this timespan yourself)
by changing $do_bump in the script, you can define wether the post's time will be altered or not.

Enjoy, and don't forget to click install

Notice: If you have installed the Proxy ip to real ip conversion or Proxy Detector v3.1 Hack, then you should probably take a look at this post.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #132  
Old 09-23-2004, 12:07 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Since the new version handles most of the conditions without extra queries, you should not see any impacts on huge forums
Reply With Quote
  #133  
Old 09-23-2004, 05:38 PM
Slynderdale Slynderdale is offline
 
Join Date: Mar 2002
Location: New York State
Posts: 576
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I made some edits to this hack, this allows you to control it via Admin CP Settings so you can modify the settings for it and turn double post checking on and off. Its backwards compatible so this hack will work even if you don't add the settings.

Note:
Please backup your includes/functions_newpost.php before your install these changes.


In file includes/functions_newpost.php find Xenon's original code and replace it with this:
PHP Code:
// ### POST NEW POST ###
// doublepost check
$isdoublepost false;
$doubleposttime = (intval($vboptions['doubleposttime'])>0?intval($vboptions['doubleposttime']):3600);
if (
$type != 'thread' AND $threadinfo['lastpost'] > TIMENOW $doubleposttime AND $threadinfo['lastposter'] == $post['postusername'] AND $vboptions['doublepostenabled'] == 1) {
    
$doublepost $DB_site->query_first("
     SELECT postid, pagetext, post.userid
     FROM " 
TABLE_PREFIX "post AS post
     LEFT JOIN " 
TABLE_PREFIX "deletionlog AS deletionlog ON(deletionlog.primaryid = post.postid AND type = 'post')
     WHERE threadid = 
$threadinfo[threadid]
     AND dateline > " 
. (TIMENOW $doubleposttime) . "
     AND visible = 1 AND deletionlog.primaryid IS NULL
     ORDER BY dateline DESC
     LIMIT 1
    "
);
 
    if (
$doublepost['userid'] == $bbuserinfo['userid'])
{
    
// we truely have a doublepost, now check if the merged post fits the rules!
    
$oldmsg $post['message'];
    
$olderrors $errors;
 
    
$post['message'] = $doublepost['pagetext'] . "\n\n" $post['message'];
    
verify_post_errors($type$post$errors);
    if (
sizeof($errors) == 0)
    {
     
// merged post is ok, so do merging
     
$isdoublepost true;
     
$post['postid'] = $doublepost['postid'];
    }
    else
    {
     
// merging will produce errors so keep it as a single post..
     
$isdoublepost false;
     
$post['message'] = $oldmsg;
    }
    unset(
$oldmsg);
    
$errors $olderrors;
    unset(
$olderrors);
}
}
 
if (
$isdoublepost)
{
// change this to false if you don't want doubleposts changing post's dateline
$do_bump = (isset($vboptions[doublepostbump])?$vboptions[doublepostbump]:1);
 
// Yes we have a doublepost, so do unindexing
require_once('./includes/functions_databuild.php');
delete_post_index($doublepost['postid'], $doublepost['title'], $doublepost['pagetext']);
unset(
$doublepost);
 
// Update DB
$DB_site->query("
    UPDATE " 
TABLE_PREFIX "post
    SET pagetext = '" 
addslashes($post['message']) . "',
    " 
iif($do_bump'dateline = ' TIMENOW ',''') . "
    attach = attach + 
$totalattachments
    WHERE postid = 
$post[postid]
"
);
 
//Delete Eventually parsed cached post
$DB_site->query("DELETE FROM " TABLE_PREFIX "post_parsed WHERE postid = " $post['postid']);
 
if (
$totalattachments OR $do_bump)
{
    
$DB_site->query("
     UPDATE " 
TABLE_PREFIX "thread
     SET " 
iif($do_bump'lastpost = ' TIMENOW ',''') . "
     attach = attach + 
$totalattachments
     WHERE threadid = 
$threadinfo[threadid]
    "
);
}
 
//Update forum if postdate has changed.
if ($do_bump)
{
    
$DB_site->query("
     UPDATE " 
TABLE_PREFIX "forum
     SET lastpost = " 
TIMENOW ",
     lastposter = '" 
addslashes($post['postusername']) . "',
     lastthread = '" 
addslashes($threadinfo['title']) . "',
     lastthreadid = 
$threadinfo[threadid],
     lasticonid = " 
iif($threadinfo['pollid'], -1$threadinfo['iconid']) . "
     WHERE forumid = 
$foruminfo[forumid]
    "
);
}
}
else
{
$DB_site->query("
    INSERT INTO " 
TABLE_PREFIX "post
     (threadid, parentid, title, username, userid, dateline, pagetext, allowsmilie,
     showsignature, ipaddress, iconid, visible, attach)
    VALUES
     (
$threadinfo[threadid]$parentid, '" addslashes($post['title']) . "',
     '" 
addslashes($post['postusername']) . "', $bbuserinfo[userid], " TIMENOW ",
     '" 
addslashes($post['message']) . "', $post[enablesmilies]$post[signature],
     '" 
addslashes($post['ipaddress']) . "', $post[iconid]$post[visible]$totalattachments)
"
);
$post['postid'] = $DB_site->insert_id();

Now to add the options, this can be done manually or with the queries below. I choosed to add them in the Posting settings group.

Manually Add then:

Varname: doublepostenabled
Type: yesno
Value: 1
Title: Check for double posts
Description: If enabled, it will check to see if the user already posted in the thread in a certain time limit, if so, their new post text will be added to their old post.

Varname: doublepostbump
Type: yesno
Value: 1
Title: Double posts bumping
Description: If enabled, and someone double posts, do you want the thread to be bumped because of the changes?

Varname: doubleposttime
Type:
Value: 3600
Title: Double post time
Description: The time in seconds you want to check for double posting.


OR

Queries:
[sql]
INSERT INTO `setting` VALUES ('doublepostenabled', 'posting', '1', '', 'yesno', 250, 0, 0);
INSERT INTO `setting` VALUES ('doublepostbump', 'posting', '1', '', 'yesno', 260, 0, 0);
INSERT INTO `setting` VALUES ('doubleposttime', 'posting', '3600', '3600', '', 270, 0, 0);

INSERT INTO `phrase` VALUES ('', 0, 'setting_doublepostenabled_title', 'Check for double posts', 5000);
INSERT INTO `phrase` VALUES ('', 0, 'setting_doublepostenabled_desc', 'If enabled, it will check to see if the user already posted in the thread in a certain time limit, if so, their new post text will be added to their old post.', 5000);
INSERT INTO `phrase` VALUES ('', 0, 'setting_doublepostbump_title', 'Double posts bumping', 5000);
INSERT INTO `phrase` VALUES ('', 0, 'setting_doublepostbump_desc', 'If enabled, and someone double posts, do you want the thread to be bumped because of the changes?', 5000);
INSERT INTO `phrase` VALUES ('', 0, 'setting_doubleposttime_title', 'Double post time', 5000);
INSERT INTO `phrase` VALUES ('', 0, 'setting_doubleposttime_desc', 'The time in seconds you want to check for double posting.', 5000);
[/sql]
Reply With Quote
  #134  
Old 09-23-2004, 11:19 PM
HappyPike's Avatar
HappyPike HappyPike is offline
 
Join Date: Feb 2002
Location: USA
Posts: 131
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Xenon
Since the new version handles most of the conditions without extra queries, you should not see any impacts on huge forums
Cool. I installed it on my forum.

*clicked install *
Reply With Quote
  #135  
Old 09-25-2004, 12:08 AM
HappyPike's Avatar
HappyPike HappyPike is offline
 
Join Date: Feb 2002
Location: USA
Posts: 131
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think I found a little bug:

On my forum I set the attachments per post limit to 5. But people are able to create post with 9 attachments after I install this hack.
Reply With Quote
  #136  
Old 09-26-2004, 10:05 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

have you installed the newest version of this hack?

I prevented such things with the last upgrade, so can you please tell me if your hack'sversion is 1.4?
If yes, i wonder why, but will put it on my bug-to-fix-list

thx in advance
Reply With Quote
  #137  
Old 09-26-2004, 10:38 PM
HappyPike's Avatar
HappyPike HappyPike is offline
 
Join Date: Feb 2002
Location: USA
Posts: 131
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yup, I installed the latest 1.4 version.
Reply With Quote
  #138  
Old 09-27-2004, 10:23 AM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hmm, kay thx for reporting, i'll look into it
Reply With Quote
  #139  
Old 09-27-2004, 10:13 PM
HappyPike's Avatar
HappyPike HappyPike is offline
 
Join Date: Feb 2002
Location: USA
Posts: 131
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

1) Xenon, how can I turn off this feature for certain forums? For example, for forum IDs 5, 10, and 20?

Some of my users have been whining because they need to reserve several posts in a row for some types of threads in certain forums.

2) It would be great if the make new post page can be edited to include a checkbox that says something like "Disable auto-merging". This way posters who prefer to make the post separate has a mean to do so. I wouln't need to disable the feature just for certain forums if this possible.

Thanks in advance for your help.
Reply With Quote
  #140  
Old 09-28-2004, 06:53 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm, sorry the attachment problem will stay a while, as attachment setting checkings are done somewhere else and not where the other checks are done, i'll try to write an easy fix, but i'm currently strongly overworked, and so the next version may take a bit of time...

as for excluding some forums:

find:
PHP Code:
if ($type != 'thread' AND $threadinfo['lastpost'] > TIMENOW 3600 AND $threadinfo['lastposter'] == $post['postusername']) 
and change it into:
PHP Code:
if ($type != 'thread' AND !in_array($threadinfo['forumid'], array(x,y,z)) AND $threadinfo['lastpost'] > TIMENOW 3600 AND $threadinfo['lastposter'] == $post['postusername']) 
and replace x,y,z with your list of forumids
Reply With Quote
  #141  
Old 10-02-2004, 05:55 AM
theArchitect's Avatar
theArchitect theArchitect is offline
 
Join Date: Sep 2004
Location: Sydney
Posts: 417
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sensational mod. *theArchitect clicks install*.

Will you be releasing an updated ones that works with your Hidden Posts mod? I only ask as since I have installed this if I post in a thread and then write a hidden post the two are combined. As you can imagine this is not the best scenario.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:12 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05094 seconds
  • Memory Usage 2,361KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete