1010use tp \TouchPointWP \Interfaces \module ;
1111use tp \TouchPointWP \Utilities \Http ;
1212use tp \TouchPointWP \Utilities \PersonQuery ;
13- use tp \TouchPointWP \Utilities \Session ;
1413use WP_Error ;
1514use WP_User ;
1615
@@ -56,7 +55,7 @@ public static function init(): void
5655 add_filter ('login_redirect ' , [self ::class, 'redirectLoginCompleteMaybe ' ], 10 , 3 );
5756
5857 // If configured, prevent admin bar from appearing for subscribers
59- add_action ( ' after_setup_theme ' , [ self ::class, ' removeAdminBarMaybe ' ] );
58+ self ::removeAdminBarMaybe ( );
6059 }
6160
6261
@@ -200,7 +199,7 @@ public static function redirectLoginCompleteMaybe(string $redirect_to, ?string $
200199 }
201200
202201 $ redirect = TouchPointWP::instance ()->settings ->auth_change_profile_urls === 'on ' ;
203- $ redirect &= !TouchPointWP::userHasEditingPermissions ();
202+ $ redirect &= !TouchPointWP::userHasEditingPermissions ($ user );
204203
205204 /**
206205 * Controls whether to redirect to the TouchPoint login automatically.
@@ -210,7 +209,7 @@ public static function redirectLoginCompleteMaybe(string $redirect_to, ?string $
210209 $ redirect = apply_filters ('tp_redirect_after_login ' , $ redirect );
211210
212211 // if there is no defined redirect page, redirect to the home page
213- if ($ redirect && (! isset ( $ _GET [ ' redirect_to ' ]) || $ _GET [ ' redirect_to ' ] == '' ) ) {
212+ if ($ redirect && $ redirect_to == '' ) {
214213 return home_url ();
215214 }
216215
@@ -225,7 +224,7 @@ public static function removeAdminBarMaybe(): void
225224 {
226225 $ removeBar = (TouchPointWP::instance ()->settings ->auth_prevent_admin_bar === 'on ' )
227226 && !is_admin ()
228- && !current_user_can ( ' edit_posts ' );
227+ && !TouchPointWP:: userHasEditingPermissions ( );
229228
230229 /**
231230 * Allows for hiding the WordPress-provided Admin bar.
0 commit comments