Posted: July 15, 2019 at 12:08 pm
|
I purchased WP User Integration with Event Espresso. When registering for events, guests now have to log in (which is desired). But, I also have custom profile fields in buddypress (i.e. Gender, age, education), for which I’ve also included as custom fields in the event registration form (EE). How can I easily take what a User submits in the EE custom fields and update the matching Buddypress custom profile fields with it? This feature seems to be available for First Name, Last Name, and email only. Thanks in advance. |
|
i see that the values are stored in esp_answer.ANS_value. Is there a way to update buddypress profiles with the data without manually creating some kind of SQL trigger? |
Hi there, First Name, Last Name and Email are the only values synced from EE to the WP user profile currently, so to update other meta fields you’ll need custom code either way. I’m guessing payment/registration status doesn’t matter here? Meaning you just want the values updated as soon as you have them available to you? |
|
|
The user is already able to update the meta fields from their bp profile page, but the EE event registration should allow them the opportunity to enter new values, and if they do, should update the corresponding bp meta fields. It’s meant to be an alternate means to update bp meta fields if necessary. i.e. If the user’s buddypress Education field is ‘High School’, and later on, he registers for an event as a ‘Bachelor of Science’, the buddypress profile field Education ought to catch it from the EE form. Hopefully that makes sense. |
Yeah, I understand what you are trying to do, but what should happen if the user registers onto a ticket, enters their details (including the Education field) as above and then does not continue payment… should the value still be updated? I’m assuming it should be but people want this to work in different ways and it’s the differences which determine the hook you need to use. So far it sounds like you could use the Meaning you’d hook in and pull the answers for the custom questions on your registration form, then use the values to update the user meta/bp fields. |
|
|
Hi Tony, THanks for that hook you provided. I tried to google/search this forum for examples on how that hook works and it’s not yet very clear to me. I’ve seen different argument types passed to it ( I’d really like to dodge hiring a developer to write code where possible. Thanks! |
The best example I can give you is the method from the User integration add-on
The filter is passed an If you don’t want to hire a developer to code this for you, you’ll need to learn how to use our models to pull the details you need, you’ll find the docs here: https://github.com/eventespresso/event-espresso-core/tree/master/docs/G–Model-System Here is an example that uses our models system to pull the value of a question liked to a registration object ( That should get you most of what you need. |
|
|
Sir, by some horrible, utterly horrible experimentation, I have figured it out. Using the sample code here: https://github.com/eventespresso/ee-code-snippet-library/blob/master/addons/eea-wp-user/mn_wp_user_addon_save_custom_answers_too.php BUT for the longest time, the $prev_answer_value constantly returned the custom answer equal to the number of different questions I had. For example, if I had 5 questions, and the answer to my variable It was not until I insert the variables for my $prev_answer_values on line 37 (before return $input_args) did it return the string answer once, rather than multiple times. Can you elaborate on how the code pulls the answers, and why it was happening repeatedly? How might one tell it to pull 1 instance of the answer earlier? Thank you! |
Without knowing the exact changes you made I can’t say. The query for the answer has a limit of 1, meaning 1 value should (and when using that example, is) be returned. Are you also using the |
|
|
If I had to guess, the code supplied performs the operation equal to the number of questions that there are, hence the multiplication of answers, but there does not seem to be a loop anywhere. It will forever be a mystery I am using the hook |
|
buddypress fields are being updated with something like |
The support post ‘Update Buddypress custom xprofile field from EE event registration form’ 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.