Prefill registartion fields
-
Can I prefill an registration field with value from shortcode from another plugin?
-
Correction:
Can I prefill an registration field with value from shortcode from another plugin?That is not possible in EME.
What fields can automacilly be filled with the WP user logged in user data?
Lastname, firstname and email. And if their profile contains the phone info in the extra phone field provided by EME, that too.
Can you make this possible with a future request for a filter or something?
Feel free to post a feature request at https://www.e-dynamics.be/wordpress
Is there a way to prefill an custom field with the value that was used in a previous registration (data from the person that is created by eme)?
There is now, see eme_field_value_filter (it is not yet documented, because it is just released today).
Edit: doc updated.Thank you. Do you have an example how to use this. I am not farmiliar with the use of filters.
I am trying to use the new filter for changing field values. I have a custom formfield named “JBN Nummer” and I want this to be filled with the users jbn_number from wp_user.
This is my code but nothing happens:
function my_formfield_filter($formfield,$postfield_name,$value) { // do a print_r of $formfield, etc ... to see the content. Check the wordpress userid with wp_get_current_user() and do all magic you want :-) // as an example, let's change the value of a field if it is called 'testfield') $current_user = wp_get_current_user(); $jbn = $current_user->jbn_number; if ($formfield['field_name']=='JBN Nummer') { return $jbn; } else { return $value; } } add_filter('eme_field_value_filter','my_formfield_filter',10,3);What am I doing wrong?
wp_get_current_user doesn’t return the user metadata I guess.
Check your $jbn variable (do a print_r in the filter, see if it returns what you want; at the same time you can see if it enters the if-statement as expected).
Also, if it is empty, check https://codex.ww.wp.xz.cn/Function_Reference/get_user_meta
or the easier (seems to get all userdata): https://codex.ww.wp.xz.cn/Function_Reference/get_userdatawp_get_current_user does return the metadata. I use a php code snippet plugin to test the php code in a page and it does echo the user meta data.
If I use you’re code and only change “testfield” in my EME custom field name “JBN Number” it doesn’t return EEE. Is my expectation correct or am I completely wrong?
Should work. Try putting “print_r($jbn);” before the if-statement, just to see if the filter gets executed at all (and remove it again afterwards of course).
On the same note you can afterwards try a print_r($formfield)Sorry sorry sorry sorry!!!!!
I didn’t update EME to 2.0.69
Shame on me!
Try 2.0.74 then 🙂
The topic ‘Prefill registartion fields’ is closed to new replies.