At time of user registration using the registration add on how can i get the new user_id?

By: Jay Mac | Asked: 05/25/2023
ForumsCategory: General questionsAt time of user registration using the registration add on how can i get the new user_id?
Jay Mac asked 1 year ago
I have tried the code below but it just returns a 0.   I assume that means that the wp user_id has not been created yet when the hook frm_after_create_entry fires.   Any thoughts on how to get this number? I can't get it from user meta and I can't get it from the form entry at least it isn't visible. The field key refers to the special formidable field    User ID      that does not show on the form $userid0010= FrmField::get_id_by_key('userid0010'); $wp_userid => $_POST['item_meta'][$userid0010];   Thanks,   J
2 Answers
Victor Font answered 1 year ago

The user id is definitely created by the time frm_after_create_entry fires, otherwise the user id wouldn't be saved with the form entry. Every table row in frm_items and frm_item_metas has a reference field to user id. When you debug your code, have you tried pausing the execution of your callback and directly examining the $_POST associative array values? Have you used PHPMyAdmin to confirm the user_id is stored with the entry records? Are you absolutely certain 'userid0010' is the correct field key for the user_id field on the form?

Jay Mac answered 1 year ago
Thanks Victor - Your knowledge is obviously way past my capabilities. I just created a new hidden field and defaulted that field to the meta key and then used the hidden field value.  J

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right