Hello,
Yes this is possible, using a bit of code.
add_action( 'wppb_register_success' , 'usermeta_from_query_string', 10, 3 );
function usermeta_from_query_string($REQUEST, $form_name, $user_id){
if(isset($_GET['query_string'])){
update_user_meta( $user_id, 'my_custom_meta_key',$_GET['query_string']);
}
}
Using this code hooked to Profile Builder’s wppb_register_succes, you can insert into the user meta the value from the query string called “query_string”.
Thanks for your reply but where do i have to add this code exactly?
You can add it in your active theme’s functions.php file, or even better in an empty plugin like this one.
Thanks again
i have added it there but still having troubles.
Let’s say that i call the URL such as
registerpage/?my_custom_meta_key=123
Then the user registers.
Where do i see that the field my_custom_meta_key is equal to 123?
Thanks!
For now, you have it stored in the Usermeta table.
You can use get_user_meta() to retrieve it in PHP.
In your case you can use:
get_user_meta($user_id, 'my_custom_meta_key', true)
If you want to display it in the back-end in the Users table or Profile, here is a useful link.
You can also get this displayed using a custom shortcode, which you can implement using add_shortcode.