Support

Home Forums WP User Integration Add profile information from registration page

Add profile information from registration page

Posted: November 6, 2013 at 6:00 pm

Viewing 2 reply threads


Stian Morsund

November 6, 2013 at 6:00 pm

So.. I have successfully been using the action provided here: https://gist.github.com/sethshoultes/5574217 to automatically create a user from the event registration page. It uses the wp_update_user function to update the user fields in WordPress. But I would also like to add other personal information from the form automatically. I tried to insert the fields like this:
` ‘event_espresso_address’ => $attendee_data[‘address’],
‘event_espresso_address2’ => $attendee_data[‘address2’],
‘event_espresso_city’ => $attendee_data[‘city’],
‘event_espresso_state’ => $attendee_data[‘state’],
‘event_espresso_zip’ => $attendee_data[‘zip’],
‘event_espresso_country’ => $attendee_data[‘country’]`

But I’m guessing this doesn’t work because these fields aren’t a native part of the WP user system. Is there an “espresso_update_user”-hook for Event Espresso I can use in addition to wp_update_user for automatically registering these fields?

Best regards


Tony

  • Support Staff

November 7, 2013 at 2:48 am

The code you have added above is close but can’t be used in the wp_update_user() function.

You need to use update_user_meta() to add the field to the profile.

http://codex.wordpress.org/Function_Reference/update_user_meta

‘event_espresso_address’ => $attendee_data['address'],

becomes

update_user_meta($user_id, 'event_espresso_address’, $attendee_data['address'])

Do the same for each field you would like to save.

You could add that on say line 23 on-wards of that gist.

Depends on what you want to do with the data then, but to retrieve use get_the_author_meta()

So for the example above

echo get_the_author_meta( 'event_espresso_address', $user->ID )


Stian Morsund

November 7, 2013 at 3:19 am

Thanks! You’re a legend.

Viewing 2 reply threads

The support post ‘Add profile information from registration page’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso