Created
February 25, 2013 17:16
-
-
Save jaygooby/5031419 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 // Redirect admins to the dashboard and other users elsewhere | |
35 add_filter( 'login_redirect', 'dkis_login_redirect', 10, 3 ); | |
36 function dkis_login_redirect( $redirect_to, $request, $user ) { | |
37 // Is there a user? | |
38 if ( is_array( $user->roles ) ) { | |
39 // Is it an administrator? | |
40 if ( in_array( 'administrator', $user->roles ) ): | |
41 return '/wp-admin/'; | |
42 else: | |
43 if ( in_array( 'teacher', $user->roles ) ): | |
44 return home_url( '/music-leader-zone/teacher-register-login/' ); | |
45 else: | |
46 if ( in_array( 'school', $user->roles ) ): | |
47 return home_url( '/school-zone/school-register-login/' ); | |
48 else: | |
49 return home_url(); | |
50 endif; | |
51 endif; | |
52 endif; | |
53 } | |
54 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment