vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Prevent Doubleposting (https://vborg.vbsupport.ru/showthread.php?t=96602)

Cyricx 11-23-2005 03:29 PM

double merging, you mean like it duplicated what you were merging into the post and put it twice?

Xenon 11-24-2005 05:07 PM

exactly

i found it a bit funny ^^

Paul M 11-25-2005 07:57 AM

Hmm, well I installed this on my test forum last night, and yes, it has (had) two problems ;

1. The post dateline is not updated on a merge, so it doesn't get seen as unread.

2. The one everyone complains about - no ajax refresh (unless you alter the time stamp, then you get two versions of the same post).


So, since I wanted this on our forum I have fixed both locally - this is what I have done.


1. To fix the timestamp ;

Find ;

PHP Code:

// set info 

Add below it ;

PHP Code:

$dataman2->set('dateline'TIMENOW); 

2. To fix the ajax issue, use this nasty hack ;

Find ;

PHP Code:

    if ($isdoublepost)
    {
        
$id $doublepost['postid'];
        
$dataman->save();
        
        
//now add edited by
        
if ($dp_settings['editedbymsg'] != '')
        {
            
$vbulletin->db->query_write("
                REPLACE INTO " 
TABLE_PREFIX "editlog (postid, userid, username, dateline, reason)
                VALUES (
$id, " $vbulletin->userinfo['userid'] . ", '" addslashes($vbulletin->userinfo['username']) . "', " TIMENOW ", '" addslashes($dp_settings['editedbymsg']) . "')
            "
);
        }
    } 

Replace with ;

PHP Code:

    if ($isdoublepost)
    {
        
// Ugly hack added by Paul M to fix ajax merge //
        
if (!$vbulletin->GPC['ajax'])
        {
            
$id $doublepost['postid'];
            
$dataman->save();
        
            if (
$dp_settings['editedbymsg'] != '')
            {
                
$vbulletin->db->query_write("
                REPLACE INTO " 
TABLE_PREFIX "editlog (postid, userid, username, dateline, reason)
                VALUES (
$id, " $vbulletin->userinfo['userid'] . ", '" addslashes($vbulletin->userinfo['username']) . "', " TIMENOW ", '" addslashes($dp_settings['editedbymsg']) . "')
                "
);
            }
        }
        
$vbulletin->url 'showthread.php?' $vbulletin->session->vars['sessionurl'] . "p=$post[postid]#post$post[postid]";
        eval(
print_standard_redirect('redirect_postthanks'truefalse));
    } 

Seems to work okay for me, feel free to try it. :)

Boofo 11-25-2005 08:15 AM

Paul, then how will you know when the first post was written? ;)

Paul M 11-25-2005 08:25 AM

You won't (unless perhaps you add it into the seperator). I don't really care as we only use a 1 hour limit for double posts anyway. If it bothers you then simply don't do step 1 - your choice. :)

keymistress 11-25-2005 08:32 AM

does this script work on version 3.5.1?
before your hack i tried on 3.5 and it's ok but it doesn't seem to be working for 3.5.1...
or maybe it's just me...

Boofo 11-25-2005 08:33 AM

Quote:

Originally Posted by Paul M
You won't (unless perhaps you add it into the seperator). I don't really care as we only use a 1 hour limit for double posts anyway. If it bothers you then simply don't do step 1 - your choice. :)

All I did was ask a question, not complain.

Paul M 11-25-2005 08:38 AM

Quote:

Originally Posted by Boofo
All I did was ask a question, not complain.

All I did was answer it. :p

moonclamp 11-25-2005 09:22 AM

Quote:

Originally Posted by Paul M
All I did was answer it. :p

Why did you call that a 'nasty' hack if it works?

Is there potential for problems?

Snake 11-25-2005 12:25 PM

Quote:

Originally Posted by moonclamp
Why did you call that a 'nasty' hack if it works?

Is there potential for problems?

I was going to ask the same thing lol.

Boofo 11-25-2005 12:31 PM

Quote:

Originally Posted by Paul M
All I did was answer it. :p

This is the part I was referring to:

Quote:

If it bothers you then simply don't do step 1
;)

Paul M 11-25-2005 03:45 PM

Quote:

Originally Posted by moonclamp
Why did you call that a 'nasty' hack if it works?

Is there potential for problems?

There are no problems with it, it's just a phrase. :)

The 'fix' is really just a workaround to bypass ajax rather than a proper fix using ajax.

Boofo 11-25-2005 03:57 PM

Quote:

Originally Posted by Paul M
Hmm, well I installed this on my test forum last night, and yes, it has (had) two problems ;

1. The post dateline is not updated on a merge, so it doesn't get seen as unread.

2. The one everyone complains about - no ajax refresh (unless you alter the time stamp, then you get two versions of the same post).


So, since I wanted this on our forum I have fixed both locally - this is what I have done.


1. To fix the timestamp ;

Find ;

PHP Code:

// set info 

Add below it ;

PHP Code:

$dataman2->set('dateline'TIMENOW); 

2. To fix the ajax issue, use this nasty hack ;

Find ;

PHP Code:

    if ($isdoublepost)
    {
        
$id $doublepost['postid'];
        
$dataman->save();
 
        
//now add edited by
        
if ($dp_settings['editedbymsg'] != '')
        {
            
$vbulletin->db->query_write("
                REPLACE INTO " 
TABLE_PREFIX "editlog (postid, userid, username, dateline, reason)
                VALUES (
$id, " $vbulletin->userinfo['userid'] . ", '" addslashes($vbulletin->userinfo['username']) . "', " TIMENOW ", '" addslashes($dp_settings['editedbymsg']) . "')
            "
);
        }
    } 

Replace with ;

PHP Code:

    if ($isdoublepost)
    {
        
// Ugly hack added by Paul M to fix ajax merge //
        
if (!$vbulletin->GPC['ajax'])
        {
            
$id $doublepost['postid'];
            
$dataman->save();
 
            if (
$dp_settings['editedbymsg'] != '')
            {
                
$vbulletin->db->query_write("
                REPLACE INTO " 
TABLE_PREFIX "editlog (postid, userid, username, dateline, reason)
                VALUES (
$id, " $vbulletin->userinfo['userid'] . ", '" addslashes($vbulletin->userinfo['username']) . "', " TIMENOW ", '" addslashes($dp_settings['editedbymsg']) . "')
                "
);
            }
        }
        
$vbulletin->url 'showthread.php?' $vbulletin->session->vars['sessionurl'] . "p=$post[postid]#post$post[postid]";
        eval(
print_standard_redirect('redirect_postthanks'truefalse));
    } 

Seems to work okay for me, feel free to try it. :)

Shouldn't that be:

PHP Code:

 $dataman2->set_info('dateline'TIMENOW);[/ 


Paul M 11-25-2005 04:16 PM

I don't believe so.

The line probably should't be with the other set_info lines, that just happens to be where I stuck it. :)

Boofo 11-25-2005 04:26 PM

Quote:

Originally Posted by Paul M
I don't believe so.

The line probably should't be with the other set_info lines, that just happens to be where I stuck it. :)

Ok, good enough for me. Installed. ;)

Snake 11-25-2005 04:33 PM

So Paul, this should fix the AJAX issue that we all are having, right?

Xenon 11-25-2005 05:28 PM

@Paul: the first thing is not a problem, it's designed that way ;)

the change of the dateline was optional in the 3.0 version, but not in the original version, as it allows bumping...

Paul M 11-25-2005 05:59 PM

Quote:

Originally Posted by Xenon
@Paul: the first thing is not a problem, it's designed that way ;)

It's a problem to me, and a few others from reading the thread. We don't use it for "anti bumping", we just hate it when people double/treble post in quick sucession. The 'fix' is optional of course. :)

@Aftermath - Yes, it gets round it.

moonclamp 11-25-2005 07:46 PM

Quote:

Originally Posted by Paul M
There are no problems with it, it's just a phrase. :)

The 'fix' is really just a workaround to bypass ajax rather than a proper fix using ajax.

But will ajax still work on the initial post?

Paul M 11-25-2005 07:56 PM

Yes.

xxskullxx 11-25-2005 08:09 PM

Thank you Paul for the update. I will try this out now. :)

Snake 11-26-2005 10:46 AM

Coolio. I will definitely try this out tonight.

dan35 11-26-2005 10:57 PM

Quote:

Originally Posted by Paul M
Hmm, well I installed this on my test forum last night, and yes, it has (had) two problems ;

1. The post dateline is not updated on a merge, so it doesn't get seen as unread.

2. The one everyone complains about - no ajax refresh (unless you alter the time stamp, then you get two versions of the same post).


So, since I wanted this on our forum I have fixed both locally - this is what I have done.


1. To fix the timestamp ;

Find ;

PHP Code:

// set info 

Add below it ;

PHP Code:

$dataman2->set('dateline'TIMENOW); 

2. To fix the ajax issue, use this nasty hack ;

Find ;

PHP Code:

    if ($isdoublepost)
    {
        
$id $doublepost['postid'];
        
$dataman->save();
        
        
//now add edited by
        
if ($dp_settings['editedbymsg'] != '')
        {
            
$vbulletin->db->query_write("
                REPLACE INTO " 
TABLE_PREFIX "editlog (postid, userid, username, dateline, reason)
                VALUES (
$id, " $vbulletin->userinfo['userid'] . ", '" addslashes($vbulletin->userinfo['username']) . "', " TIMENOW ", '" addslashes($dp_settings['editedbymsg']) . "')
            "
);
        }
    } 

Replace with ;

PHP Code:

    if ($isdoublepost)
    {
        
// Ugly hack added by Paul M to fix ajax merge //
        
if (!$vbulletin->GPC['ajax'])
        {
            
$id $doublepost['postid'];
            
$dataman->save();
        
            if (
$dp_settings['editedbymsg'] != '')
            {
                
$vbulletin->db->query_write("
                REPLACE INTO " 
TABLE_PREFIX "editlog (postid, userid, username, dateline, reason)
                VALUES (
$id, " $vbulletin->userinfo['userid'] . ", '" addslashes($vbulletin->userinfo['username']) . "', " TIMENOW ", '" addslashes($dp_settings['editedbymsg']) . "')
                "
);
            }
        }
        
$vbulletin->url 'showthread.php?' $vbulletin->session->vars['sessionurl'] . "p=$post[postid]#post$post[postid]";
        eval(
print_standard_redirect('redirect_postthanks'truefalse));
    } 

Seems to work okay for me, feel free to try it. :)


After using this, I can't post any new thread. Submit new thread, it just pops up a blank page.

Paul M 11-26-2005 11:38 PM

Quote:

Originally Posted by dan35
After using this, I can't post any new thread. Submit new thread, it just pops up a blank page.

Well the answer is simple enough, if it don't work for you don't use it.

FYI, It works for me, on two 3.5.1 systems, and no one else seems to have a problem .....

EasyTarget 11-28-2005 07:54 AM

nm.. learned it in the readme :D
great hack

xxskullxx 11-28-2005 10:49 AM

@ Paul M:

When I add
PHP Code:

 $dataman2->set('dateline'TIMENOW); 

I get this error:
Quote:

Fatal error: Call to a member function on a non-object in c:\appserv\www\ng\forums\includes\functions_newpos t.php on line 271
Adding everything else works fine.

3.5.1

Boofo 11-28-2005 10:51 AM

Quote:

Originally Posted by xxskullxx
@ Paul M:

When I add
PHP Code:

 $dataman2->set('dateline'TIMENOW); 

I get this error:
Adding everything else works fine.

Are you running RC2 by chance? ;)

xxskullxx 11-28-2005 10:53 AM

Sorry just edited my post. Running 3.5.1. I haven't updated my profile in awhile, lol.

Boofo 11-28-2005 10:55 AM

Quote:

Originally Posted by xxskullxx
Sorry just edited my post. Running 3.5.1. I haven't updated my profile in awhile, lol.

Well, it worked fine for me on RC3, although I just took it out and skipped that part of the instrctions Paul gave. Since mine is set at an hour, updating the post time doesn't really make that much sense to me, anyway. ;)

utw-Mephisto 12-01-2005 10:54 PM

Quote:

Originally Posted by Paul M
Hmm, well I installed this on my test forum last night, and yes, it has (had) two problems ;

1. The post dateline is not updated on a merge, so it doesn't get seen as unread.

2. The one everyone complains about - no ajax refresh (unless you alter the time stamp, then you get two versions of the same post).


So, since I wanted this on our forum I have fixed both locally - this is what I have done.


1. To fix the timestamp ;

Find ;

PHP Code:

// set info 

Add below it ;

PHP Code:

$dataman2->set('dateline'TIMENOW); 

2. To fix the ajax issue, use this nasty hack ;

Find ;

PHP Code:

    if ($isdoublepost)
    {
        
$id $doublepost['postid'];
        
$dataman->save();
        
        
//now add edited by
        
if ($dp_settings['editedbymsg'] != '')
        {
            
$vbulletin->db->query_write("
                REPLACE INTO " 
TABLE_PREFIX "editlog (postid, userid, username, dateline, reason)
                VALUES (
$id, " $vbulletin->userinfo['userid'] . ", '" addslashes($vbulletin->userinfo['username']) . "', " TIMENOW ", '" addslashes($dp_settings['editedbymsg']) . "')
            "
);
        }
    } 

Replace with ;

PHP Code:

    if ($isdoublepost)
    {
        
// Ugly hack added by Paul M to fix ajax merge //
        
if (!$vbulletin->GPC['ajax'])
        {
            
$id $doublepost['postid'];
            
$dataman->save();
        
            if (
$dp_settings['editedbymsg'] != '')
            {
                
$vbulletin->db->query_write("
                REPLACE INTO " 
TABLE_PREFIX "editlog (postid, userid, username, dateline, reason)
                VALUES (
$id, " $vbulletin->userinfo['userid'] . ", '" addslashes($vbulletin->userinfo['username']) . "', " TIMENOW ", '" addslashes($dp_settings['editedbymsg']) . "')
                "
);
            }
        }
        
$vbulletin->url 'showthread.php?' $vbulletin->session->vars['sessionurl'] . "p=$post[postid]#post$post[postid]";
        eval(
print_standard_redirect('redirect_postthanks'truefalse));
    } 

Seems to work okay for me, feel free to try it. :)


http://ut2004.titaninternet.co.uk/vb...con_woohoo.gif

utw-Mephisto 12-02-2005 08:09 AM

One addition : bbcodes don't work ...

http://www.ut2007world.com/showpost....43&postcount=4

dan35 12-04-2005 12:03 AM

Quote:

Originally Posted by Paul M
Well the answer is simple enough, if it don't work for you don't use it.

FYI, It works for me, on two 3.5.1 systems, and no one else seems to have a problem .....


A big thank you for your help in getting my problem solved!

If everyone got the same problem, just do step 2, ignore step 1 ;)

Delphiprogrammi 12-04-2005 01:55 PM

hi people,

Can't get this to work i always get this error

Quote:

Fatal error: Undefined class name 'vbulletinhook' in functions_newpost.php
that errors keeps on appaering even if i restore the original functions_newpost.php file i can't find the cause ...

Andreas 12-05-2005 08:34 AM

For those interested, here is an experimental Plugin.

Delphiprogrammi 12-05-2005 09:38 AM

Quote:

Originally Posted by Delphiprogrammi
hi people,

Can't get this to work i always get this error



that errors keeps on appaering even if i restore the original functions_newpost.php file i can't find the cause ...

i'm an idiot i'm testing 3.5.x code on vb 3.0.7 pffff :devious: my testboard stil vb 3.0.7 updating it ..

Paul M 12-05-2005 10:03 AM

Quote:

Originally Posted by Andreas
For those interested, here is an experimental Plugin.

Tested, but I get the following error on a double post ;

Code:

Database error in vBulletin 3.5.1:

Invalid SQL:

                        SELECT MAX(dateline) AS dateline
                        FROM post AS post
                        WHERE threadid = 192
                        AND dateline <
                        AND visible = 1;

MySQL Error  : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND visible = 1' at line 5
Error Number : 1064
Date        : Monday, December 5th 2005 @ 12:01:57 PM
Script      : http://www.cableforum.info/board/newreply.php
Referrer    : http://www.cableforum.info/board/showthread.php?t=192
IP Address  : xx.xx.xx.xx
Username    : Paul M
Classname    : vb_database

Also, the new post is merged into the existing post twice.

Andreas 12-05-2005 10:33 AM

Hmm, I can't reproduce such problems on my board.

But I think the SQL error is releated to thread/forum subscriptions, as the Datamanager won't return the postid.

Edit: Reproduced.

Actually, the database error causes the double merge:

The QR AJAX JS gets the database error and attempts a repost.

Paul M 12-05-2005 11:36 AM

Yep - it works - not quite as I (persoanally) want it to, but it does work. :)

I've added the dateline update on a double post (maybe that should be an option).

The main thing I dislike is that it doesn't reload the post automatically - you have to click on the QR 'error' message (there seems to be redirect code in it, not sure why it's not called - a bug maybe ?).

redspider 12-05-2005 11:46 AM

Quote:

Originally Posted by Paul M
Yep - it works - not quite as I (persoanally) want it to, but it does work. :)

I've added the dateline update on a double post (maybe that should be an option).

The main thing I dislike is that it doesn't reload the post automatically - you have to click on the QR 'error' message (there seems to be redirect code in it, not sure why it's not called - a bug maybe ?).

I try it and is doing the same thing for me .

Andreas 12-05-2005 11:59 AM

The redirect Code is called, the JS XML Handler catches it, detects the "error" message and displays it.

Unfortunately, there is no way to automatically reload the page - JS won't be executed and a meta refresh can only occur in the head-section of a HTML document.

An alternative would be to generate a postbit and display it, but then you would have the post displayed 2 times: The post that was already there and the merged post as a new post.

Replacing the existing post via AJAX ist not possible without changes to the JS files.


All times are GMT. The time now is 09:15 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.02107 seconds
  • Memory Usage 1,940KB
  • 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
  • (1)bbcode_code_printable
  • (19)bbcode_php_printable
  • (22)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (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