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.

using gform options to manipulate register user addon

  1. hi,
    I have a form which has a selection of options for payment (via paypal, via cheque or via local authority). Paypal works fine using the paypal addon (redirects the user to paypal and once payment is received and registers the user as a fully fledged user.).

    I need to know which hook to use (and how to use it) to register the user as a specific user type (ie: "user-pending") if an option other than paypal is selected.

    To sum up:
    If "pay with paypal" is selected, register user via paypal addon as "user" after payment.
    If "pay with cheque" or "pay via local authority" is selected, ignore paypal addon and register the user as "user-pending".

    Thanks

    Posted 8 years ago on Wednesday June 8, 2011 | Permalink
  2. any ideas on this?

    Posted 8 years ago on Tuesday June 14, 2011 | Permalink
  3. The User Registration Add-On developer documentation can be found here:

    http://www.gravityhelp.com/documentation/page/User_Registration_Add-on_Developer_Docs

    The hook you would most likely want to use is the gform_user_registered hook which can be found here:

    http://www.gravityhelp.com/documentation/page/Gform_user_registered

    You'd have to check the entry data to see what was selected and then update the users role using that hook so it happens when they register.

    Posted 8 years ago on Tuesday June 14, 2011 | Permalink
  4. Hi Carl,
    Does this hook fire regardless of the paypal plugin setting "register user only when payment received"?

    Thanks for the pointer!

    Posted 8 years ago on Wednesday June 22, 2011 | Permalink
  5. Yes, it should fire when the user is registered regardless of the PayPal plugin setting.

    Posted 8 years ago on Wednesday June 22, 2011 | Permalink
  6. Hi Carl,

    How would I pull out the ID of the registered user so that I can update the user role when a successful paypal transaction has been processed?

    I have it set so that no matter what the user is registered, I just need to change the role after the paypal transaction has been done. The other two options register the user on signup as pending, paypal will change that to active

    Posted 8 years ago on Monday June 27, 2011 | Permalink
  7. I have asked our developer that works on the User Registration Add-On to chime in on this. He is currently traveling so a soon as he gets a chance he will reply to this thread.

    Posted 8 years ago on Monday June 27, 2011 | Permalink
  8. Hi Tom Tong,

    You'll probably want to use the gform_paypal_fulfillment hook which is fired when a PayPal transaction is fulfilled successfully.

    The user ID will not be readily available here; however, since you have the $entry, you have access to the $entry['id']. Each user created by the User Registration add-on has an "entry_id" custom meta value for the entry they were created by. You can then user the default WP function get_users() to return the user with the meta key "entry_id" and the meta value of the entry ID available in the paypal hook.

    Posted 8 years ago on Tuesday June 28, 2011 | Permalink
  9. Thanks guys, your support is phenominal and always appreciated!

    many thanks!!!

    Posted 8 years ago on Tuesday June 28, 2011 | Permalink
  10. I came up with this snippet:

    add_filter("gform_paypal_fulfillment", "update_user_acc_status", 10, 4);

    function update_user_acc_status($entry) {
    global $wpdb;
    $user = get_user_by_email($entry['7']);
    $wp_user_object = new WP_User($user->ID);
    $wp_user_object->set_role('employer_active');
    }

    This basically means you can use the paypal add-on to renew membership, and alongside another snippet I wrote you can use gravity forms to manage a membership site :)

    Posted 8 years ago on Wednesday July 13, 2011 | Permalink