Verify Submitter’s Email Address

Home Forums Quform WordPress Verify Submitter’s Email Address

This topic is: resolved
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #30647
    MediaServices
    Participant

    One of our uses of Quform is for voting where we determine winners based on the number of votes submitted. We’d like to make sure that submitted email addresses are actually valid, and also that the person using an email address to submit a vote actually owns that email address. So fat the best idea we’ve have is using double opt in where the submitter is sent a link by email that must be clicked to validate an entry. From reading support messages I saw some 2011 messages that double opt in had not been added yet.

    Do you now have double opt in or another method for us to verify the person submitting an email actually owns the email address they are using?

    • This topic was modified 4 years, 2 months ago by MediaServices.
    #30652
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #31850
    MediaServices
    Participant

    Thank you. I cannot get this code to work.

    UPDATED BELOW TO REFLECT functions.php correction. Last year’s minimum vote counting was not working and I got that fixed by going back to an earlier version of my functions.php and re-entering the code. I still cannot get the code above to work fully. Details below.

    • We are running Quform 2.0 for WordPress on this form.
    • Our form is #15. [quform id="15" name="description goes here"]
    • In the first line of your code, I’ve left ‘quform_post_validate_1 unchanged’
    • In the second line of code after setValue I’ve changed ‘quform_1_729’ to ‘quform_1_340’, and ‘quform_15_340’.
    • Our hidden field’s unique ID as seen here https://support.themecatcher.net/quform-wordpress-v2/guides/basic/finding-the-element-unique-id is 15_340. All occurrences of 729 have been changed to 340
    • Our checkbox field’s unique ID as seen here https://support.themecatcher.net/quform-wordpress-v2/guides/basic/finding-the-element-unique-id is 15_341. 729 has been changed to 341
    • For the autoreply email I’ve edited the link from <a href="https://www.example.com/confirm-vote?key={element|id:729|Hidden}">CLICK HERE TO CONFIRM YOUR VOTE</a> to match our form <a href="http://www.myexamplesite.com/my-confirm-form/?key={element|id:729|Hidden}">CLICK HERE TO CONFIRM YOUR VOTE</a>
      </il>

      UIPDATED
      I will list my code below, but first here’s what happens. I fill out the form and click the SEND button and get my Confirmation message that voting has been successful, please check our email. I receive an email with the link, but the ?key= is always blank, so the URL to click is http://www.myexamplesite.com/my-confirm-form/?key= and when I click it and land on my confirmation I am now getting the error message ‘Vote failed, key not found.’.

      Of course no validation checkbox fields have Yes as their value, all of them are empty even after I click on the link sent by email.

      SAMPLE 1: quform_1_340 for setValue

      
      add_filter('quform_post_validate_1', function (array $result, Quform_Form $form) {
          $form->setValue('quform_1_340', sha1(uniqid()));	
      
          return $result;
      }, 10, 2);
      
      add_shortcode('confirm_vote', function () {
          if (!isset($_GET['key']) || !is_string($_GET['key'])) {
              return 'Vote failed, key missing.';
          }
      
          global $wpdb;
          $repository = quform('repository');
          $query = "SELECT entry_id FROM " . $repository->getEntryDataTableName() . " WHERE element_id = 340 AND value = %s";
          $result = $wpdb->get_var($wpdb->prepare($query, $_GET['key']));
      
          if ($result == null) {
              return 'Vote failed, key not found.';
          }
      
          $repository->saveEntryData($result, array(340 => '', 341 => serialize(array('Yes'))));
      
          return 'Thank you, your vote has been confirmed.';
      });
      

      SAMPLE 2: quform_15_340 for setValue

      
      add_filter('quform_post_validate_1', function (array $result, Quform_Form $form) {
          $form->setValue('quform_15_340', sha1(uniqid()));	
      
          return $result;
      }, 10, 2);
      
      add_shortcode('confirm_vote', function () {
          if (!isset($_GET['key']) || !is_string($_GET['key'])) {
              return 'Vote failed, key missing.';
          }
      
          global $wpdb;
          $repository = quform('repository');
          $query = "SELECT entry_id FROM " . $repository->getEntryDataTableName() . " WHERE element_id = 340 AND value = %s";
          $result = $wpdb->get_var($wpdb->prepare($query, $_GET['key']));
      
          if ($result == null) {
              return 'Vote failed, key not found.';
          }
      
          $repository->saveEntryData($result, array(340 => '', 341 => serialize(array('Yes'))));
      
          return 'Thank you, your vote has been confirmed.';
      });
      

      I have also tried changing line 1 ‘quform_post_validate_1’ to ‘quform_post_validate_15’.

      I look forward to your reply.

    • This reply was modified 3 years, 8 months ago by MediaServices. Reason: Added another detail
    • This reply was modified 3 years, 8 months ago by MediaServices. Reason: Added CODE tags around link code
    • This reply was modified 3 years, 8 months ago by MediaServices. Reason: Fixed typo
    • This reply was modified 3 years, 8 months ago by MediaServices. Reason: UPDATE functions.php Correction
    • This reply was modified 3 years, 8 months ago by MediaServices.
    #31859
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #31926
    MediaServices
    Participant

    Yes it worked! Thank you!

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy