Opened 3 years ago
Closed 3 years ago
#12387 closed defect (bug) (fixed)
has_cap issue with Super Admins editing profile
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.0 |
| Component: | Administration | Version: | 3.0 |
| Severity: | normal | Keywords: | multisite needs-patch |
| Cc: | miklb@… |
Description
If a Super Admin is in the backend of a site they are not a user on, and tries to edit their own profile via Network->Users, you receive a Call to a member function has_cap() on a non-object wp-admin/includes/user.php on line 80
This bug seems to date back in WPMU to at least 2.8.6 in my testing.
I would expect a Super Admin to be able to edit their profile from anywhere, but if that's not the case, and they need to be a user of of the site they are in, then some more graceful error message I think would be appropriate.
Attachments (1)
Change History (10)
comment:2
dd32
— 3 years ago
- Keywords has-patch needs-testing added
- Milestone changed from Unassigned to 3.0
comment:3
automattor
— 3 years ago
comment:6
miklb
— 3 years ago
So to confirm, that is the desired behavior? A Super Admin can't edit their own profile while in the backend of a site they aren't a member of? This fix shows a "You can’t give users that role." error, which still seems odd. If they are a Super Admin, editing their own profile, or any user for that matter why would they get that error?
comment:7
nacin
— 3 years ago
- Keywords multisite needs-patch added; has-patch needs-testing removed
- Owner set to nacin
- Status changed from new to assigned
L80: $wp_roles->role_objects[$new_role]->has_cap() would also fail on PHP4 as object chaining is not supported.
My MS environment is down right now, But i've attached a (untested) patch, If someone could test this under PHP4 and the affected environment mentioned, that'd be appreciated