Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // the _3 prefix has to match the id of the form you have created
- add_action( "gform_after_submission_3", "login_form_after_submission", 10, 2 );
- function login_form_after_submission($entry, $form) {
- // get the username and pass
- $username = $entry[1];
- $pass = $entry[2];
- $creds = array();
- // create the credentials array
- $creds['user_login'] = $username;
- $creds['user_password'] = $pass;
- // sign in the user and set him as the logged in user
- $sign = wp_signon( $creds );
- wp_set_current_user( $sign->ID );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement