Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

Liltiger on "Redirect Login for Non Admins to Profile"

$
0
0

Howdy,

I've tried to modify wp-login.php to redirect the login page to the profile if they're non admins. I'm halfway there. The code below redirects all users to the profile. Will someone tell me where I went wrong?

Thanks!

if ( isset( $_REQUEST['redirect_to'] ) ) {
		$redirect_to = $_REQUEST['redirect_to'];
		// Redirect to https if user wants ssl
		if ( $secure_cookie && false !== strpos($redirect_to, 'wp-admin') )
			$redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
	} else {
                <strong>if( current_user_can('administrator') ) {</strong>
		$redirect_to = admin_url();
                <strong>} else {
                $redirect_to = admin_url( 'profile.php' );
                }</strong>
	}

Viewing all articles
Browse latest Browse all 8245

Trending Articles