get_user_field() is not working for me. I have a field with a Unique Field ID of “city”, but when I put echo get_user_field("city");
into my php file it doesn’t return anything. I’ve confirmed that my code is written correctly by using echo get_user_field("s2member_access_level")
along side it which returns a 1.
Get_user_field() not working as intended
Use this:
$custom_fields = get_user_option(‘s2member_custom_fields’, $payment_user_id);
and you will have a variable $custom_fields[‘city’] to read from.
Thanks, I got this to work. I have one more issue.
I’m also using BuddyPress so the Name field in the registration form is in BuddyPress and not s2Members so I don’t know how to grab that field. Would you be able to tell me that?
The s2M don’t have “own” registration forms, it uses WP registration procedure. Means, if BP saves the name in WP manner, you will be able to find it by $current_user->firstname and $current_user->lastname, as usual.