Ticket #1825 (closed defect (bug): fixed)

Opened 6 years ago

Last modified 6 years ago

Display a User's Role in profile.php and user-edit.php

Reported by: MichaelH Owned by: davidhouse
Priority: normal Milestone:
Component: Administration Version: 1.6
Severity: minor Keywords: role capabilities bg|has-patch bg|squashed
Cc:

Description

The Users->Your Profile screen should display that user's current Role.

Actually, it's more important to show the user's Role in Users->Authors&Users; Edit a specific user (user-edit.php).

Attachments

show_role_on_profile.diff Download (2.5 KB) - added by davidhouse 6 years ago.
admin-functions.php.patch Download (701 bytes) - added by ringmaster 6 years ago.
Apply this after davidhouse's patch to prevent a edit_users user from demoting himself.
admin-functions.php.2.patch Download (433 bytes) - added by ringmaster 6 years ago.
Oops. Need to remove some leftovers.
show_user_role_in_profile.diff Download (659 bytes) - added by MichaelH 6 years ago.
just David's change to profile.php to show users their current role

Change History

  • Keywords bg|has-patch added

Covers both requirements.

  • Keywords bg|squashed added
  • Owner changed from anonymous to davidhouse
  • Status changed from new to assigned

Accepting and tagging as per westi's suggestions.

With the patch installed, you can change a User's Role in user-edit.php, but you are allowed to "demote" yourself from being an administrator. As mentioned in  Ticket 1645, the User should not be able to subtract edit_users capability from themselves.

To promote a user to administrator (that should kill ringmaster P) using phpMyAdmin, change wp_metauser for the user_id:

wp_capabilites to: a:1:{s:13:"administrator";b:1;} and wp_user_level to: 10

davidhouse: your patch does more than I asked for! Thanks.

Apply this after davidhouse's patch to prevent a edit_users user from demoting himself.

comment:4   ryan6 years ago

  • Status changed from assigned to closed
  • Resolution set to fixed

(In [2995]) Show Role in profile and user edit. Don't allow users with edit_users caps to demote themselves. Props: davidhouse, ringmaster. fixes #1825

Oops. Need to remove some leftovers.

  • Status changed from closed to reopened
  • Resolution fixed deleted

Some code got left in that shouldn't have. My fault.

Applying the last patch will remove code from admin-functions.php that will ensure that the user can't remove the edit-users capability from himself.

comment:6   matt6 years ago

  • Status changed from reopened to closed
  • Resolution set to fixed

(In [3064]) Fixes #1825 again so people can't demote themselves

  • Status changed from closed to reopened
  • Resolution fixed deleted

Reopening because David's patch (show_role_on_profile.diff) for profile.php to show the User their current Role is no longer in the code.

just David's change to profile.php to show users their current role

comment:8   ryan6 years ago

I think Matt purposefully removed it.

  • Status changed from reopened to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.