-1

I'm using gravity forms and have a fairly extensive profile for each user. They are able to add 5 other forms of data to their profile/user meta. My users are able to send an email to a non user and ask a yes no question. The link in the email fills in the registered users email and the unique ID for any of the other 5 forms which add to the registered users meta. I need the non registered user who clicks the yes/no link in the email to update the registered users meta. I'm using the user-registration add-on from gravity forms. The form with the yes no question is all setup to update the registered user meta but the person responding does not have an account so they are receiving the "you must be logged in" message. Any ideas on how I can allow a non registered user to submit a form and update the registered users meta with their response? Again I do have the registered users email and unique ID (not their user ID) being passed via the url to the form with the yes no question.

Thanks!

0

wp_ajax_nopriv_{$action} can trigger a non-logged in ajax request.

add_action( 'wp_ajax_nopriv_add_foobar', 'prefix_ajax_add_foobar' );

function prefix_ajax_add_foobar() {
    // Handle request then generate response using WP_Ajax_Response
}

get_user_by can pull the user's data via email

$user = get_user_by('email', 'user@example.com')

update_user_meta can update the user's metadata.

update_user_meta( $user->ID, $meta_key, $meta_value, $prev_value );
  • most of this makes sense but I think I need to use the Gravity Forms gform_after_submission hook to pull the entry data and then get_user_by and update_user_meta as suggested. There are some additional complications but I need to get this start proper first. – rezon8dev Dec 31 '15 at 2:42
  • Makes sense. This site tends to frown on plugin specific questions and I don't have Gravity Forms so all I can do is make these general suggestions. – jgraup Dec 31 '15 at 2:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.