Make WordPress Core

Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#18164 closed defect (bug) (fixed)

Users with capes don't need promote_users on their new role

Reported by: nacin's profile nacin Owned by: nacin's profile nacin
Milestone: 3.3 Priority: normal
Severity: normal Version:
Component: Network Admin Keywords: has-patch
Focuses: multisite Cc:

Description

When setting your own role:

		// The new role of the current user must also have promote_users caps
		if ( $id == $current_user->ID && !$wp_roles->role_objects[$_REQUEST['new_role']]->has_cap('promote_users') ) {
			$update = 'err_admin_role';
			continue;
		}

There's no reason to prevent a super admin from demoting themselves on a site.

Attachments (2)

18164.diff (793 bytes) - added by fonglh 13 years ago.
18164.2.diff (792 bytes) - added by fonglh 13 years ago.

Download all attachments as: .zip

Change History (10)

#1 @johnbillion
14 years ago

How does one get a cape?

#2 @zippykid
14 years ago

Step 1 - Visit http://www.superherosupplies.com/

Step 2 - Add cape to cart

Step 3 - Go through check out procedure

Step 4 - Wait for delivery truck

Step 5 - Receive and Open package - find out it's shoes your wife ordered, go back outside to wait for delivery truck

Step 6 - Receive package - open - find cape

Step 7 - Wear cape.

Step 8 - Commence core hacking.

Last edited 14 years ago by zippykid (previous) (diff)

#3 @fonglh
13 years ago

  • Keywords has-patch added

Checks for cape before deciding if user can demote himself.

#4 @nacin
13 years ago

The more generic is_super_admin() would probably be a better fit here.

@fonglh
13 years ago

@fonglh
13 years ago

#5 @fonglh
13 years ago

Thanks for the tip! I've updated the patch to use is_super_admin()

#6 @nacin
13 years ago

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

In [19024]:

Allow a super admin to demote themselves on a site to a role that does not contain the promote_users cap. props fonglh, fixes #18164.

#7 @nacin
13 years ago

Thanks for the patch, fonglh!

#8 @fonglh
13 years ago

No problem! Glad to have been able to make my first contribution to core.

Note: See TracTickets for help on using tickets.