vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Prevent Doubleposting (https://vborg.vbsupport.ru/showthread.php?t=59916)

Goodspeed 08-30-2004 05:40 AM

Great hack Xeon! Thank you! Going to install it...

But at first I have a question: what I need to do to switch off double post prevention after some time left? Is it possible to merge posts during appointed time?

Mosh 08-30-2004 07:01 AM

Quote:

Originally Posted by Xenon
very easy, just remove that line:

Code:

AND dateline > " . (TIMENOW - 3600) . "
and that part:
PHP Code:

AND $threadinfo['lastpost'] > TIMENOW 3600 


Xenon,

That worked an absolute treat.

Thanks ever so much for this.

JD. :)

btw. JD clicks Install :)

Xenon 08-30-2004 09:58 AM

@Goodspeed: hmm, i'm not sure if i get what you want.
If you want the merge just within the first xxy hopurse, use the default, if you want the merge whenever there's a doublepost show the code i posted for sinclair.

or do you mean that within 10 minutes no post should be merged, and then during the next hour it should?
everything is possible by changing just the conditions :)

Goodspeed 08-30-2004 04:57 PM

I'm sorry for my english Xenon, still not too good in it :(

Yes, I want to merge posts only during last 10 minutes, after that new post in thread by the same user should appear as new.
What kind of conditions should I change?

And one more question: is it possible to mark added text after merge? For example by adding line: Added by User at some time...

Thank you!

Xenon 08-30-2004 09:05 PM

no prob :)

just replace
Code:

AND dateline > " . (TIMENOW - 3600) . "
with
Code:

AND dateline > " . (TIMENOW - 3600) . " AND dateline < " . (TIMENOW - 600) . "
as well as replace
PHP Code:

AND $threadinfo['lastpost'] > TIMENOW 3600 

with
PHP Code:

AND $threadinfo['lastpost'] > TIMENOW 3600 AND $threadinfo['lastpost'] < TIMENOW 600 

as for the merging text addition:
in
PHP Code:

$post['message'] = $doublepost['pagetext'] . "\n\n" $post['message']; 

replace the "\n\n" with for example:

PHP Code:

$post['message'] = $doublepost['pagetext'] . "\nAdded at " vbdate($vboptions['dateformat'], TIMENOW) . "\n" $post['message']; 


Goodspeed 08-30-2004 09:26 PM

I did everything, checked it twice, but merge not work after those changes.
Now, posts appear one by one without merging.

Update
After couple of tests I understood that is problem in first two changes. I removed them and it works but without 10 min limit.

Addition with update date working GREAT! Thank you very much!

I changed it a little bit: added update time.

PHP Code:

$post['message'] = $doublepost['pagetext'] . "\n\n<strong><i>Added at " vbdate($vboptions['dateformat'], TIMENOW) . ", " vbdate($vboptions['timeformat'], TIMENOW) . "</i></strong>" "\n" $post['message']; 


bjornstrom 09-13-2004 07:00 AM

Works great - thanks a lot /Martin

Snatch 09-13-2004 08:40 AM

What do this hack if the Maximum number of sings per post reached and the Memver must creat an new one to complett the post ?

Xenon 09-13-2004 09:45 AM

since the newest version it checks if the merged post is still a vald one.
If it is, then the post will be merged, if it's not valid anymore (too much chars/images or whatever) it will create a new post just as it would do without the hack :)

HappyPike 09-23-2004 01:38 AM

Looks like a cool hack, Xenon. :) Does it have any impact on forum performance on a large forum?

Xenon 09-23-2004 12:07 PM

Since the new version handles most of the conditions without extra queries, you should not see any impacts on huge forums :)

Slynderdale 09-23-2004 05:38 PM

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]

HappyPike 09-23-2004 11:19 PM

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 *

HappyPike 09-25-2004 12:08 AM

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.

Xenon 09-26-2004 10:05 PM

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

HappyPike 09-26-2004 10:38 PM

Yup, I installed the latest 1.4 version.

Xenon 09-27-2004 10:23 AM

hmm, kay thx for reporting, i'll look into it :)

HappyPike 09-27-2004 10:13 PM

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.

Xenon 09-28-2004 06:53 PM

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

theArchitect 10-02-2004 05:55 AM

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.

Xenon 10-02-2004 12:01 PM

hmm, actually i don't like to post hack which include other hacks' infos so that everyone can use a single hack without needing another, but i may look at it, if it's doable without getting in problems with single instals i'll do so :)

silentwille 10-22-2004 11:19 AM

Hello,
any question, it's possible to add "Edit by" or other, when the second post is merged in the post of member ??

Thx

Xenon 10-22-2004 04:04 PM

Not by default.

It's on my todo list, but i'm too busy with moreimportant things these times...

Yuneek 10-29-2004 07:46 PM

I installed and then tested and I could double post fine - is it because I'm an administrator?

Xenon 10-30-2004 12:22 PM

Erm, nope, i did not implement any Adminspecial within that hack, so you may have made a little mistake during the install process?

leeman 11-28-2004 07:36 PM

installed and works like a charm.

question.

is there a way to make this take Threads instead....
To prevent spamming of the boards.
I have a couple of users that when they are bored they post like 5 pages of mumbo jumbo....

*LEE clicks install

Xenon 11-29-2004 07:31 PM

well, of course it's possible as well, but this would be contraproductive as well.

i know more situations when two or more threads are created shortly behind each other, but not to spam (for example news threads on some boards...)

leeman 11-30-2004 12:12 PM

Quote:

Originally Posted by Xenon
well, of course it's possible as well, but this would be contraproductive as well.

i know more situations when two or more threads are created shortly behind each other, but not to spam (for example news threads on some boards...)

Yeah that's true ...
But I get alotta problems with tr00ls spamming my board ...

And I have taken this question to the board and every one thinks it a good idea ... Just need to put the "last post time" to like +15 secs of flood time ...

So if you can alter it to / make a additional mod with this funktion ..... :insert you rock slimie here: .

Xenon 11-30-2004 03:10 PM

wouldn't it be easier to put up rules? ^^

leeman 11-30-2004 04:08 PM

Quote:

Originally Posted by Xenon
wouldn't it be easier to put up rules? ^^

I have a spam rule ... but you know ....
Well rules doesn't stop them from spamming.... and gives the mods a hell of a time cleaning it up .... :(

Xenon 12-08-2004 11:04 AM

well, hard mods will be able to solve those "spammers" ^^

Boofo 12-08-2004 11:34 AM

Stefan, is there a way to have this go by the user's timezone time instead of the server time? I noticed a user doubler-posted the other day and the time was 2 hours behind the actual double-post (the server is set at PST and I am in CST).

Xenon 12-08-2004 11:40 AM

as posts are stored in server timezone as well as the timenow variable which is used for the hack, it's not possible.

Or better, wouldn't make sense, because if you would base it on usetimezone, then it would be possible that one user can post every minute while the other must have to wait nearly a whole day until...

Boofo 12-08-2004 12:51 PM

Quote:

Originally Posted by Xenon
as posts are stored in server timezone as well as the timenow variable which is used for the hack, it's not possible.

Or better, wouldn't make sense, because if you would base it on usetimezone, then it would be possible that one user can post every minute while the other must have to wait nearly a whole day until...

But shouldn't it at least be ahead of the post time itself? This was almost 2 hours before the actual post time of the message.

Xenon 12-09-2004 08:59 PM

i think either you or me is confused now.

everything has to be based on TIMENOW as that's the value stored in the DB, and used by the phpscript.

so the hack works absolutelly correct.

if you get wierd behaviours, that could mean, that you have another hack, which manipulates the times or, a slight server problem with different times on different servers..

gilbert 12-10-2004 04:58 PM

Great hack!

leeman 12-15-2004 02:03 PM

Quote:

Originally Posted by Xenon
well, hard mods will be able to solve those "spammers" ^^


Well since i don't (sorry enough) have mods online 24/7 ....

Could you please do the code change or look at it if it's not too much trouble.

alqadir 12-16-2004 08:42 AM

If one wanted to incorporate checking of the title to validate double posting, how do you compare the title from the last post to the new post.

I want to prevent users from posting two books of the same title (the book title is part of the post title).

Thanks

Xenon 12-18-2004 12:25 PM

the value is stored in $post[title]

@leeman: sorry, i'm very very busy and cannot help you right now.

AZone 12-21-2004 09:43 PM

Great hack, thank you!
By the way, does this hack update New Posts list when someone is doubleposting?


All times are GMT. The time now is 12:49 PM.

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.01615 seconds
  • Memory Usage 1,896KB
  • 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
  • (3)bbcode_code_printable
  • (9)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)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