WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. salmosri
    Member
    Posted 3 years ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Topic