This topic contains 3 replies, has 2 voices. Last updated by Cristián Lávaque 4 years, 4 months ago.
Topic Author | Topic |
---|---|
Posted: Friday Aug 17th, 2012 at 12:24 pm #22366 | |
I’m writing a plugin that adds an action at the user_register hook. The function gets passed the new user’s ID, but the user’s first_name and last_name properties are not defined. Other WP user’s don’t seem to have this problem, so I’m wondering if this is connected to something s2Member is doing. function do_stuff($user_id) { $new_user = get_userdata($user_id); $first_name1 = $new_user->user_firstname; $first_name2 = $new_user-first_name; } I also tried this: $user_meta = get_user_meta( $new_user->ID ); and I got this (last_name and first_name are empty even though they’re defined in the user’s profile when I check as an admin): array(11) { [“wp_user_level”]=> array(1) { [0]=> string(1) “0” } [“show_admin_bar_front”]=> array(1) { [0]=> string(4) “true” } [“wp_capabilities”]=> array(1) { [0]=> string(32) “a:1:{s:10:”subscriber”;s:1:”1″;}” } [“use_ssl”]=> array(1) { [0]=> string(1) “0” } [“admin_color”]=> array(1) { [0]=> string(5) “fresh” } [“comment_shortcuts”]=> array(1) { [0]=> string(5) “false” } [“rich_editing”]=> array(1) { [0]=> string(4) “true” } [“description”]=> array(1) { [0]=> string(0) “” } [“nickname”]=> array(1) { [0]=> string(7) “emerson” } [“last_name”]=> array(1) { [0]=> string(0) “” } [“first_name”]=> array(1) { [0]=> string(0) “” } } |