Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action('formcraft_before_save', 'login_user_addon', 10, 4);
- function login_user_addon($filtered_content, $form_meta, $raw_content, $integrations)
- {
- global $fc_final_response;
- foreach ($raw_content as $key => $value) {
- if ( $value['label'] == 'Adres e-mail klienta' )
- {
- $user_email_login = $value['value'];
- }
- if ( $value['label'] == 'Hasło klienta' )
- {
- $user_pass_login = $value['value'];
- }
- }
- $user = get_user_by( 'email', $user_email_login );
- $creds = array(
- 'user_login' => $user->user_login,
- 'user_pass' => $user_pass_login
- );
- $usr = wp_signon( $creds, false );
- if ( !is_wp_error( $usr ) ) {
- wp_set_current_user ( $usr->ID );
- wp_set_auth_cookie ( $usr->ID );
- } else {
- $fc_final_response['failed'] = $user_pass_login;
- }
- }
Add Comment
Please, Sign In to add comment