Support » Fixing WordPress » Using update_usermeta in a plugin when user registers

  • Resolved darkfate

    (@darkfate)


    OK, so what I’m trying to do is add a phone field to the user registration. I’ve added the field in the registration box, and I want to use update_usermeta to add the phone to the usermeta table. I’ve been trying to use the user_register actions to put this in. The problem is that I can’t get the ID since the user has just registered and isn’t logged in. I’m just wondering if there it’s possible to get that ID at this point.

Viewing 2 replies - 1 through 2 (of 2 total)
  • darkfate

    (@darkfate)

    I’m doing this in my plugin:

    function addphone($user_id)
    {
    	global $wpdb, $phone;
    	return update_usermeta( $user_id, 'phone', $phone );
    }
    add_action('user_register','addphone');

    $user_id is returning blank and I don’t know why.

    darkfate

    (@darkfate)

    I guess it returns blank, but I realized now that it’s going into the database.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Using update_usermeta in a plugin when user registers’ is closed to new replies.