• Resolved robertherold

    (@robertherold)


    Hi,

    My page is only visible to registered users. Visitors do not.
    I would like to create a questionnaire and I would like to know if it is possible that once a user has sent the questionnaire, the next time they see a message that they have already sent the questionnaire?

    Thank you very much!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jules Colle

    (@jules-colle)

    It’s possible, but you would need to write some custom code for that.

    I can break it down for you, but I can’t do the implementation as that falls out of scope of this support forum.

    1. On form-submit, you need to set a value linked to the user that indicates they have submitted the form
    2. Before loading the form, you need to check the value
    1. if it’s set, you should render a message telling the user that they have already filled out the form
    2. if it’s not set, just show the form
    • This reply was modified 4 years, 2 months ago by Jules Colle.
    Thread Starter robertherold

    (@robertherold)

    Thank you very much for your quick reply.

    What do I need to do to share this with me?

    Plugin Author Jules Colle

    (@jules-colle)

    You could hire a developer to implement this for you. A platform to hire great developers is codeable.io. Alternatively, you could head over to my website bdwm.be and get in touch with me.

    Thread Starter robertherold

    (@robertherold)

    I found one, but once the user submits the form, it doesn’t write that you’ve submitted it once. And it lets you send it several times.

    function one_user_once($result, $tag) {
        $formName = 'Contact form 1'; // This is the form name for English and spanish
        $fieldName = 'your-email'; // Name of the field to validate, which is the email field
        $errorMessage = "you've signed up already"; // error message
        $name = $tag->name;
        if ($name == $fieldName) {
            if (is_already_submitted($formName, $fieldName, $_POST[$name])) {
                $result->invalidate($tag, $errorMessage);
            }
        }
        return $result;
    }
    add_filter('wpcf7_validate_email*', 'one_user_once', 20, 2);
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘A user can submit the form only once’ is closed to new replies.