Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#36757 closed defect (bug) (invalid)

Wordpress Bug

Reported by: ilovechocolatemuffins's profile ilovechocolatemuffins Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.5.1
Component: Users Keywords:
Focuses: Cc:

Description

I deleted two users off of Wordpress. When I go to access the dashboard or to edit a page, I received this error.

Fatal error: Call to a member function has_cap() on a non-object in /home/content/96/9964196/html/wp-content/plugins/wpmudev-updates/includes/class-wpmudev-dashboard-site.php on line 11597

A look at the function which contains line 1597, where line 1597 is if ( ! $user->has_cap( $need_cap ) ) {

Remove invalid users from the allowed-users-list.

foreach ( $allowed as $key => $user_id ) {

$user = get_userdata( $user_id );
if ( $user && ! $user->has_cap( $need_cap ) ) {

unset( $allowed[ $key ] );
$changed = true;

}

}

if ( $changed ) {

WPMUDEV_Dashboard::$site->set_option( 'limit_to_user', $allowed );

}

}

}

if ( $id_only ) {

$result = $allowed;

} else {

$result = array();
foreach ( $allowed as $user_id ) {

if ( $user_info = get_userdata( $user_id ) ) {

$result[] = array(

'id' => $user_id,
'name' => $user_info->display_name,
'is_me' => get_current_user_id() == $user_id,
'profile_link' => get_edit_user_link( $user_id ),

);

}

}

}

return $result;

}


to fix this error I had to add this to line 1597

if ( $user && ! $user->has_cap( $need_cap ) ) {

Attachments (1)

Screen Shot 2016-05-04 at 1.25.58 PM (2).png (831.7 KB) - added by ilovechocolatemuffins 7 years ago.

Download all attachments as: .zip

Change History (3)

#1 @ocean90
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Hello @ilovechocolatemuffins, welcome to our Trac!

This Trac is used for enhancements and bug reporting for the WordPress core software. Your error comes from a file which is shipped with one of your WPMU DEV plugins. You have to contact their support.

#2 @m0nty
7 years ago

This issue was related to an older version of the WPMU DEV dashboard plugin, please update your dashboard plugin. If you have any further issues, please contact WPMU DEV & not WP support.

Thanks @ocean for responding and pointing to the user to WPMU DEV.

Thanks

Last edited 7 years ago by m0nty (previous) (diff)
Note: See TracTickets for help on using tickets.