Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. <?php
  2. // the _3 prefix has to match the id of the form you have created
  3. add_action( "gform_after_submission_3", "login_form_after_submission", 10, 2 );
  4.  
  5. function login_form_after_submission($entry, $form) {
  6.  
  7. // get the username and pass
  8. $username = $entry[1];
  9. $pass = $entry[2];
  10.  
  11. $creds = array();
  12.  
  13. // create the credentials array
  14. $creds['user_login'] = $username;
  15. $creds['user_password'] = $pass;
  16.  
  17. // sign in the user and set him as the logged in user
  18. $sign = wp_signon( $creds );
  19. wp_set_current_user( $sign->ID );
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement