WordPress.org

Support

Support » Plugins and Hacks » Hacks » How to access user registration info after user registers (including meta data)

How to access user registration info after user registers (including meta data)

  • Hiya,

    I would like to hook into wordpress in my plugin after user registration functions have all completed. The trouble is my function below seems to execute before any meta data has been put into the database, thus i am not able to check against the user input.

    add_action( 'user_register', 'tml_new_user_registered' );
    
    function tml_new_user_registered( $user_id ) {
        //wp_set_auth_cookie( $user_id, false, is_ssl() );
        //wp_redirect( admin_url( 'profile.php' ) );
    	$user_info = get_userdata($user_id);
    	$subscription_value = get_user_meta( $user_id, "subscribe_to_newsletter", TRUE);
    	if($subscription_value == "Yes") {
    		//include("Subscriber.Add.php");
    	}
    
    	echo "<pre>: ";
    	print_r($user_info);
    	print_r($subscription_value);
    	echo "</pre>";
    
        exit;
    }

    I attempted to use:
    add_filter('user_register ','tml_new_user_registered',99);

    but it does not seem to work either 🙁

    Any help would be appreciated!

  • The topic ‘How to access user registration info after user registers (including meta data)’ is closed to new replies.
Skip to toolbar