• Resolved joswp



    Please do you plan to add a limit on the submission of a quiz? There is no sense of allowing the user to submit multiple times the same quiz.

    In the meantime, please could you suggest any workaround (i.e hide the submit button for the particular user after the quiz has been submitted).

    Many thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Patrick – WPMU DEV Support


    Hi @joswp

    I hope you are doing well.

    We do have this feature already requested, and I’m adding this ticket as an extra request.

    I can see our developers have a custom code that maybe help you on this.

    How long would you like to avoid the new submissions?

    The code is set to 24 hours based on the IP, but we can increase this time.

    Best Regards
    Patrick Freitas

    Thread Starter joswp


    Hey @wpmudevsupport12 Patrick many thanks for your reply.

    That custom code would be highly appreciated. Ideally I would like to avoid a second submission of a quiz for the same user forever, if that can not be achieved with the proposed code the max time span possible.

    Many thanks.

    Plugin Support Kasia – WPMU DEV Support


    Hello @joswp ,

    Please check this MU plugin:

    add_action( 'forminator_quizzes_submit_before_set_fields', function($entry){
                    'name'  => '_forminator_user_ip',
                    'value' => Forminator_Geo::get_user_ip(),
    add_action(    'forminator_before_submit_quizzes',    function( $form_model ) {
            $form_id = $form_model->id;
            $form_ids = array( 69, 74, 20 ); // IDs of the Quizes for disabling submission
            if ( in_array( intval( $form_id ), $form_ids, true ) ) {
                $user_ip = Forminator_Geo::get_user_ip();
                if ( ! empty( $user_ip ) ) {
                    $last_entry = Forminator_Form_Entry_Model::get_last_entry_by_ip_and_form( $form_id, $user_ip );
                    if ( ! empty( $last_entry ) ) {
                        $entry        = Forminator_API::get_entry( $form_id, $last_entry );
                        $current_time = strtotime( date( 'Y-m-d H:i:s' ) );
                        $future_time  = strtotime( '+1 day', strtotime( $entry->date_created_sql ) );
                        if ( $current_time < $future_time ) {
    				                'result'     => 'You cannot submit this quiz within 24 hours after submitting once!',
    				                'result_url' => '',
    				                'type'       => 'nowrong',

    Open that PHP file with any code editor. In line number 16, add your quiz id(s) separated with comma (,) for which you want to disable posting for the desired time after submitting one.
    The time you can change in the line 28, by changing the number of days:

    $future_time = strtotime( '+1 day', strtotime( $entry->date_created_sql ) );

    How to use Must Use (MU) plugins https://wordpress.org/support/article/must-use-plugins/

    kind regards,

    Thread Starter joswp


    Brilliant! Works perfectly! Many thanks Kasia.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Only one submision of a quiz’ is closed to new replies.