User Roles - roberts-sandbox/create-repo GitHub Wiki

WP-Librarian uses its own user Roles, mostly separate from WordPress Roles. There are two Library Roles: Librarian and Library Admin. WordPress Administrators are the only users who can modify a user's Library Role, including their own.

Library Roles are assigned to users as numbers and stored in User Meta with the key wp_lib_role. A Library Admin is represented as 10 and a Librarian as 5. This means a user with a wp_lib_role of 7 would be able to access WP-Librarian as a Librarian.

A user's Library permissions are set via WP_LIBRARIAN::updateUserPermissions().

Mostly Separate?

WP-Librarian's permissions checking functions wp_lib_is_librarian() and wp_lib_is_library_admin() use user's Library Role meta to check if a user has a high enough number to perform an action. By contrast, all WordPress related permissions checking is done via their Capabilities system. This annoying disparity came about when I first implemented permission. As the capabilities system looked scary and different I decided to implement a simpler system. There is currently an issue open about this and it will one day be resolved.

⚠️ **GitHub.com Fallback** ⚠️