I’m attempting to login a person from customized person registration type.
My Code for Customized person Register is
operate register_user($information) {
$userdata = array(
'user_login' => $information['email'],
'user_email' => $information['email'],
'user_pass' => $information['pssword'],
'user_nicename' => $information['fname'],
'display_name' => $information['fname'],
);
$usermetedata = array(
'son_name' => $information['son_name'],
'form' => $information['shape'],
'siret' => $information['siret'],
'company_email' => $information['company_email'],
'company_activity' => $information['activity'],
'workers' => $information['staff'],
'position_held' => $information['position_held'],
'company_phone' => $information['company_phone'],
'company_mobile' => $information['company_mobile'],
'company_address' => $information['company_address'],
'company_postal' => $information['company_postal'],
'company_ville' => $information['company_ville'],
'url' => $information['url'],
'personal_region' => $information['personal_region'],
'personal_address' => $information['personal_address'],
'personal_ville' => $information['personal_ville'],
'personal_postal' => $information['personal_postal'],
'personal_phone' => $information['personal_phone'],
'personal_mobile' => $information['personal_mobile'],
'dob' => $information['dob'],
'invite_email' => $information['invite_email']
);
$userid = wp_insert_user($userdata);
foreach ($usermetedata as $key => $val):
add_user_meta($userid, $key, $val);
endforeach;
gdlr_new_user_registered($userid);
// echo 'Registration full. Goto <a href="' . get_site_url() . '/wp-admin">login web page</a>.';
if ($userid) {
user_activation($userid, $information);
}
}
And My code for Login at present register person is
operate gdlr_new_user_registered( $user_id ) {
$person = get_user_by( 'id', $user_id );
wp_set_auth_cookie( $user_id, false, is_ssl() );
$redirect_to = site_url().'le-reseau-social/teepy-tableau-de-bord/';
do_action( 'wp_login', $user->user_login );
return $redirect_to;
}
add_filter('login_redirect', 'gdlr_new_user_registered', 10, 3);
However I’m not capable of login please recommend me or let me know if i’m doing a little mistake.
Thanks