email verification in wordpress

Posted: June 11, 2015 in Uncategorized
Tags: , , , , , , ,

recently i got task to perform email verification when user registered..for that i created for that retrieve all information about user and then add in usermeta table with usermeta key “confirmation”.the value of that key could be random number or timestamp(recommend to user timestamp)..now the question is how to verify during registration..for that there is a code as follow:

function check_user_status($user, $username, $password) {
if (in_array( ‘subscriber’, (array) $user->roles ) ) {
if (get_user_meta($user->ID, ‘confirm_mail’, true) == 1) { return $user; }
else{ return new WP_Error(‘Account Not Active.’); }
}
else{ return $user; }
}
add_filter(‘authenticate’,’check_user_status’, 30, 3);

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s