Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wpf_true_auto_login() {
- if( ! isset( $_GET['cid'] ) ) {
- return;
- }
- if( ! isset( $_GET['key'] ) || $_GET['key'] != wp_fusion()->settings->get( 'access_key' ) ) {
- return;
- }
- $contact_id = sanitize_text_field( $_GET['cid'] );
- $user_id = wp_fusion()->user->get_user_id( $contact_id );
- if( empty( $user_id ) || user_can( $user_id, 'manage_options' ) ) {
- return;
- }
- $user = get_user_by( 'id', $user_id );
- if( ! $user->user_email == $_GET['email'] ) {
- return;
- }
- // Login
- wp_set_current_user( $user_id, $user->user_login );
- wp_set_auth_cookie( $user_id );
- do_action( 'wp_login', $user->user_login, $user );
- }
- add_action('init', 'wpf_true_auto_login');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement