Reply To: action hook after registration

Home Forums Pie-Register 2.0 Support action hook after registration Reply To: action hook after registration

#4558

Vanessa Grimes
Participant

Thank you Hasnain, I just tried using that hook but I have a few problems with doing so.

First, is that when I use that hook, the user’s meta-data still appears to not be set yet. Here is my code:

function __construct() {
	add_action( 'pie_register_after_register_validate', array( $this, 'registered' ) );
...
}
function registered( $user ) {
	$user_ID = get_current_user_id();
	$regtype = get_user_meta($user_id,"register_type",true);
	error_log($regtype, 0);
}

The log file shows a blank line for $regtype.

My second issue is that if I want my plugin to work for everyone, I need to be able to hook into a common action that is available regardless of whether your plugin is installed or not, so when I originally asked for another action hook, I wasn’t expecting you to suggest a proprietary one. I was hoping you had a do_action somewhere that calls the standard WP actions to complete the process, such as the user_register action. Lastly, I still have a separate hook for the user_register action, and that does fire AFTER your proprietary action, and with the same get_user_meta command, the register_type value is still not in the database. If it’s available in pie_register_after_register_validate and that fires before user_register, then I shouldn’t need pie_register_after_register_validate, and should just need user_register, but the data’s just not there. Or am I using get_user_meta incorrectly? I’m sorry, this is my first try at developing this plugin, but I thought for sure that is the proper way to use get_user_meta.

Thanks for any additional help you can provide.
-VG