Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#8493 closed defect (bug) (fixed)

wp-login.php redirect to profile.php broken

Reported by: drossy Owned by: anonymous
Priority: normal Milestone: 2.8
Component: General Version:
Severity: normal Keywords: has-patch needs-testing
Cc:

Description

wp-login.php has code that should redirect users without the capability to edit posts to their profile page upon login rather than the dashboard, however it seems to be checking for the wrong value of $redirect_to, the patch adds in the value that worked for me.

Derek Ross

*** wp-login.php.old	2008-08-26 18:57:29.000000000 +0100
--- wp-login.php	2008-12-04 22:46:22.000000000 +0000
***************
*** 429,433 ****
  	if ( !is_wp_error($user) ) {
  		// If the user can't edit posts, send them to their profile.
! 		if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' ) )
  			$redirect_to = admin_url('profile.php');
  		wp_safe_redirect($redirect_to);
--- 429,433 ----
  	if ( !is_wp_error($user) ) {
  		// If the user can't edit posts, send them to their profile.
! 		if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url()) )
  			$redirect_to = admin_url('profile.php');
  		wp_safe_redirect($redirect_to);
***************

Change History (2)

  • Keywords has-patch needs-testing added

comment:2   ryan4 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [10705]) Check admin_url() when redirecting to profile. Props drossy. fixes #8493

Note: See TracTickets for help on using tickets.