• I am looking to redirect the user the first time they login, to their profile page to prompt them to complete their user details (Buddypress + Multisite). If they have already logged in before they are redirected to the main site.

    I have used your solution(https://www.ads-software.com/support/topic/login-ajax-redirecting-to-1-as-url) to modify the login conditionals but can’t seem to access get_user_meta() to get the ‘last_activity’ field. (Used as validation as it is only set when the user logs in for the first time.

    $redirect = self::getLoginRedirect(self::$current_user);
                    if( $redirect != '' ){
                        $logged_user = self::$current_user;
                        if ( get_user_meta( $logged_user->ID, 'last_activity', true ) ){
                            if( $redirect != '' ){ $return['redirect'] = $redirect; }
                            if( !empty($_REQUEST['redirect_to']) ){ $redirect= wp_sanitize_redirect($_REQUEST['redirect_to']); }
                        }else{
                            $return['redirect'] = site_url();
                        }
                    }

    Any suggestions?

    https://www.ads-software.com/plugins/login-with-ajax/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘First time login redirect’ is closed to new replies.