Jump to content
DevFuse Forums
  • Submit wait per form


    Michael
    • Fixed IP.Board Version: IP.Board 4.3.x

    The submit wait function should factor in per form as well.

    Manual Patch

    Open applications/form/sources/Log/Log.php

    Find:

    $messagesSentToday = \IPS\Db::i()->select( 'COUNT(*) AS count, MAX(log_date) AS max', 'form_logs', array( 'log_ip_address=? AND log_date>?', \IPS\Member::loggedIn()->ip_address, \IPS\DateTime::create()->sub( new \DateInterval( 'PT'.$submitWait.'S' ) )->getTimeStamp() ) )->first();

    Replace With:

                if( $container )
                {
                    $messagesSentToday = \IPS\Db::i()->select( 'COUNT(*) AS count, MAX(log_date) AS max', 'form_logs', array( 'log_ip_address=? AND log_form_id=? AND log_date>?', \IPS\Member::loggedIn()->ip_address, $container->form_id, \IPS\DateTime::create()->sub( new \DateInterval( 'PT'.$submitWait.'S' ) )->getTimeStamp() ) )->first();
    
                }
                else
                {
                    $messagesSentToday = \IPS\Db::i()->select( 'COUNT(*) AS count, MAX(log_date) AS max', 'form_logs', array( 'log_ip_address=? AND log_date>?', \IPS\Member::loggedIn()->ip_address, \IPS\DateTime::create()->sub( new \DateInterval( 'PT'.$submitWait.'S' ) )->getTimeStamp() ) )->first();
                }

     


    User Feedback

    Recommended Comments

    There seems to be a difference between the provided solution vs the source code of 1.3.2

    1.3.2:

    $messagesSentToday = \IPS\Db::i()->select( 'COUNT(*) AS count, MAX(log_date) AS max', 'form_logs', array( 'log_ip_address=? AND log_date>?', $member->ip_address, \IPS\DateTime::create()->sub( new \DateInterval( 'PT'.$submitWait.'S' ) )->getTimeStamp() ) )->first();

    Compared to yours:

    $messagesSentToday = \IPS\Db::i()->select( 'COUNT(*) AS count, MAX(log_date) AS max', 'form_logs', array( 'log_ip_address=? AND log_date>?', \IPS\Member::loggedIn()->ip_address, \IPS\DateTime::create()->sub( new \DateInterval( 'PT'.$submitWait.'S' ) )->getTimeStamp() ) )->first();

    Difference:

    \IPS\Member::loggedIn()->ip_address

    is used in your solution whereas the source code (1.3.2) uses 

    $member->ip_address

    Regardless of the above, we have tried the solution and it ignores the submit timer.

    Edited by GrandTheftArmA
    Link to comment
    Share on other sites

    • Management

    If your available for testing can you try this bit of code above and see if it prints anything when viewing the form in your browser window? If not, if you can provide ftp and acp login details I can troubleshoot further.

    print \IPS\Member::loggedIn()->ip_address;
    exit;

     

    Link to comment
    Share on other sites



    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Add a comment...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.


  • Status Definitions

    Pending = We are still working on this report.

    Fixed = The issue has been fixed and the resolution will be available in the next version.

    Closed = Feedback or opinion better posted on our forum for discussion. Also for reports we cannot reproduce or need more information. In this case just add a comment and we will review it again.

     

×
×
  • Create New...