[wp-trac] [WordPress Trac] #36757: Wordpress Bug
WordPress Trac
noreply at wordpress.org
Wed May 4 21:11:52 UTC 2016
#36757: Wordpress Bug
-----------------------------------+-----------------------------
Reporter: ilovechocolatemuffins | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Users | Version: 4.5.1
Severity: normal | Keywords:
Focuses: |
-----------------------------------+-----------------------------
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 ) ) {
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36757>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list