PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Get Account Name

  1. Jon Marius
    Member

    I researched the forums, but couldn't find what I am looking for.

    I don't know if anyone will answer or if this is possible, but I am looking to make a form that when people enter a code, it will pull up the account name.

    After that, it will allow users to enter up to 10 email addresses to send to their friends/families to support their fundraising efforts, the email is generic and will only include the first name

    I want the email to be sent from the user. So if John enters the 10 email addresses, the From will be from John.

    I am not sure I am explaining myself, but if anyone knows how to do this, I'd appreciate any help. I only have the basic license, not business or developer, so I don't know if there are limitations due to licensing restrictions.

    Thanks

    Posted 12 years ago on Wednesday April 25, 2012 | Permalink
  2. David Peralty

    I guess my first question is, where do you expect to get the "account name" from?

    You can easily have a form that collects these details and e-mails a template created message to those people from the person that filled out the form. The only difficult part is the code/account name part.

    Posted 12 years ago on Wednesday April 25, 2012 | Permalink
  3. Jon Marius
    Member

    Hi David,

    Wow, I am impressed at how quickly I got a response.. Thanks for that..

    I will generate the account code and share it with the participants who will them tell their friends to enter that code online and pull up the form.

    I would love to know how to do the above!! Thanks so much David!

    Posted 12 years ago on Wednesday April 25, 2012 | Permalink
  4. David Peralty

    So I'm working with the developers on the e-mail piece but everything else is supported out of the box.

    Here is what I've done so far:

    • Created a Form
    • Added an Input field which I labelled: Enter Your Code
    • Added an input field which I labelled: Your E-mail:
    • Clicked Edit and went to Advanced
    • Selected "Enable Conditional Logic"
    • Set it to Show this field if Any of the following match:
    • Enter Your Code: is codeword (you can change this to what you want it to be)
    • Added a List Field that I labelled: Friends E-mail:
    • Set Maximum Rows to 10
    • Selected "Enable Conditional Logic" and filled it out like the Your E-mail field.

    This will make it so that these fields only show when the right code word is inputted in the first field. The issue I am bumping into right now that I'm going to be working with the developers on is how we then grab those e-mail addresses from the list field and pass them to our notification system.

    Start working on this, and let me know if it gets you closer to what you need.

    Posted 12 years ago on Wednesday April 25, 2012 | Permalink
  5. David Peralty

    Okay, so once you are done with this part, we can move on to the Notifications section.

    In notifications, go to the Message section and write out the message you want to send.
    Select the following from the Merge Tag because we are going to copy and paste it into other fields:

    • Your Name: (should look like {Your Name::2} )
    • Friends E-mail (should look like {Friends E-mail::6} )

    Copy the code for Your Name into From Name
    Change From E-mail to the Your E-mail: Field
    In BCC Copy the Friends E-mail code and add in :url after the number but before the closing bracket. It should like like {Friends E-mail::6:url}

    This form should now send to all of the e-mail addresses input in the list field when the form is submitted.

    Posted 12 years ago on Wednesday April 25, 2012 | Permalink
  6. Jon Marius
    Member

    Thanks David, I started the first portion of it, I am still trying to get the second part to work. I will ask if I need additional help! but I appreciate you getting back to me so quickly!

    Posted 12 years ago on Thursday April 26, 2012 | Permalink
  7. David Peralty

    Let me know. It was a cool thing to try to get to work. :)

    Posted 12 years ago on Thursday April 26, 2012 | Permalink
  8. Jon Marius
    Member

    Sure, I will let you know... I was wondering.. I doubt this is possible, but when a person adds the emails and send the message, would it be possible (in a perfect world it would lol) to generate a "registration" number of some sort?

    Not holding my breath on this one, but thought I'd ask.

    Posted 12 years ago on Thursday April 26, 2012 | Permalink
  9. David Peralty

    You could, but this feature is not built in and would require customization.

    If you wanted to do it, I would recommend using the following hook:
    http://www.gravityhelp.com/documentation/page/Gform_confirmation

    To create a custom confirmation message that includes the registration number.

    If you wanted to save that confirmation number to your database, then you'll have to create a hidden field, populate that hidden field with your confirmation number and then in the confirmation, grab that value and display it.

    Posted 12 years ago on Thursday April 26, 2012 | Permalink
  10. Here are some helpful links on that as well:

    http://www.gravityhelp.com/forums/topic/random-number#post-52247

    http://www.gravityhelp.com/forums/topic/guid-entry-id

    Posted 12 years ago on Thursday April 26, 2012 | Permalink
  11. Jon Marius
    Member

    First off, thanks again for the outstanding support...

    I read both of your topic suggestions and I am more confused now. I guess I was getting it by the last topic (http://www.gravityhelp.com/forums/topic/guid-entry-id) but the link with the solution david smith posted is not coming up, so I am just wondering what the actual code I need to modify would be.

    I just want a generated number, could be random or consecutive, doesn't matter.
    6 digits long, doesn't matter if it is only numeric or alpha numeric.
    I want the number to be linked to the person's name (for reporting purposes)
    and I want the number to be emailed to the person and to me

    thoughts?

    Posted 12 years ago on Thursday April 26, 2012 | Permalink
  12. Sorry about that, pastie.org is down at the moment, hopefully it will be back up soon. However, I've used this one before so I had the code snippet:

    http://pastebin.com/Fye6Xjd5

    Posted 12 years ago on Thursday April 26, 2012 | Permalink
  13. Jon Marius
    Member

    OK I copied that code ti my theme_functions.php file, then replaced the form ID and the field ID, updated file, then added a hidden field in my form and named it StudentID, but I'm stuck.. Is that all I have to do to generate the random number?

    Posted 12 years ago on Thursday April 26, 2012 | Permalink
  14. Did you update: add_filter("gform_field_value_uuid", "get_unique");

    to be: add_filter("gform_field_value_StudentID", "get_unique");

    Posted 12 years ago on Thursday April 26, 2012 | Permalink
  15. Jon Marius
    Member

    I don't know if I'm not supposed to post code on here, so if that's the case, feel free to delete it.. but this is what I have

    add_filter("gform_field_value_StudentID", "get_unique");
    
    function get_unique(){
    
        $prefix = "FP"; // update the prefix here
    
        do {
            $unique = mt_rand();
            $unique = substr($unique, 0, 6);
            $unique = $prefix . $unique;
        } while (!check_unique($unique));
    
        return $unique;
    }
    
    function check_unique($unique) {
        global $wpdb;
    
        $table = $wpdb->prefix . 'rg_lead_detail';
        $form_id = 4; // update to the form ID your unique id field belongs to
        $field_id = 2; // update to the field ID your unique id is being prepopulated in
        $result = $wpdb->get_var("SELECT value FROM $table WHERE form_id = '$form_id' AND field_number = '$field_id' AND value = '$unique'");
    
        if(empty($result))
            return true;
    
        return false;
    }

    So then I added that field id to my emails.. So far, nothing has happened, I don't see a number generated in the reports or emails.

    Posted 12 years ago on Thursday April 26, 2012 | Permalink
  16. Jon, can you send me a WP Admin login, FTP access and reference this post: rob@rocketgenius.com

    Posted 12 years ago on Thursday April 26, 2012 | Permalink
  17. David Peralty

    So the conclusion for anyone else that reads this is the following:

    Make sure your field ID matches what is in the form. In this case it needed to be changed to 10.
    Then in the properties of the field, click Advanced and put a check mark in the Allow Field to be Populated Dynamically.
    Lastly, make sure the Parameter name matches what you've put in the functions file. For this situation, it needed to be StudentID.

    Posted 12 years ago on Thursday April 26, 2012 | Permalink

This topic has been resolved and has been closed to new replies.