WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#8493 closed defect (bug) (fixed)

wp-login.php redirect to profile.php broken

Reported by: drossy Owned by:
Milestone: 2.8 Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch needs-testing
Focuses: 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)

comment:1 Denis-de-Bernardy5 years ago

  • Keywords has-patch needs-testing added

comment:2 ryan5 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.