User roles overhaul
|Reported by:||tellyworth||Owned by:||jacobsantos|
This patch changes the way user roles are stored, moving them out of the usermeta table into a new user_role table. The API is unchanged and should work exactly the same as before, but operations such as fetching a list of users by role are much faster and easier to implement with joins.
It's mostly important to mu and bbpress, but is also relevant to blogs with large user tables. I'm posting it here first for review, an mu patch is forthcoming.
The main changes are:
- User roles are no longer stored in usermeta wp_capabilities entries. They're moved to the new user_role table (blog_id, user_id, role).
- Per-user capabilities are still supported, and still stored in usermeta as before.
- The upgrade process removes any usermeta wp_capabilities that match role names, and insert user_role entries in their place.
- Old style wp_capabilities roles are still honored if they exist, to permit logging in before the upgrade has completed, but will be removed during the upgrade.
The API and upgrade process are unit tested. The capabilities API works exactly the same as before for all cases I've tested. The main thing that needs review here is the upgrade process: it has the potential to lock administrators out of the blog if it doesn't work, and it's possible it could take a long time on blogs with many users.
Change History (27)
- Keywords needs-patch added; has-patch removed
- Milestone changed from 2.9 to Future Release
- Milestone Future Release deleted
- Resolution set to wontfix
- Status changed from new to closed