=== AddonLogic Custom User Roles ===
Contributors: snehalpancholi
Tags: user roles, capabilities, custom roles, role manager, permissions
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.1
Stable tag: 1.0.0
License: GPL-2.0+
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Admin UI to create, edit, and delete custom WordPress user roles with an organized capability checklist.

== Description ==

**AddonLogic Custom User Roles** gives site administrators a clean, intuitive interface for managing WordPress user roles — without needing to write any code.

**Features:**

* View all roles (built-in + custom) in a sortable table with user count and capability count
* Create new roles with a display name, slug, and description
* Edit capabilities of any role using a grouped checklist (Posts, Pages, Users, Media, Comments, Site Admin, Themes)
* Clone capabilities from an existing role with one click
* Delete custom roles safely — affected users are automatically reassigned to Subscriber
* Built-in roles (Administrator, Editor, Author, Contributor, Subscriber) are protected from deletion
* Full CSRF protection on all form submissions
* Automatic slug generation from the display name
* Group-level "toggle all in group" checkboxes and a global "Select All" toggle
* Mobile-friendly, accessible admin UI
* Dark mode compatible

== Installation ==

1. Upload the `custom-user-roles` folder to `/wp-content/plugins/`
2. Activate the plugin through the WordPress admin → Plugins screen
3. Navigate to **Users → Custom Roles**

== Frequently Asked Questions ==

= Will deleting a custom role delete the users in that role? =
No. Users assigned to a deleted role are automatically moved to the Subscriber role.

= Can I delete built-in roles like Administrator or Editor? =
No. Built-in WordPress roles are protected and cannot be deleted through this plugin.

= Where are custom roles stored? =
WordPress stores role definitions in the `wp_user_roles` option (via the `$wp_roles` global). The plugin also stores additional meta (description, display name) in the `addlc_cur_role_meta` option.

= Is the slug editable after creating a role? =
No. The role slug is the unique identifier WordPress uses internally and cannot be changed after creation. You would need to delete and recreate the role with a new slug.

= Can I clone capabilities from any existing role? =
Yes. The "Clone From Existing Role" dropdown on the Add New Role screen lists all roles including built-in ones.

== Screenshots ==

1. Role List — shows all roles with user count, capability count, type badge, and action buttons.
2. Add New Role — form with display name, slug, description, and grouped capability checklist.
3. Clone From Role — sidebar dropdown to pre-fill capabilities from an existing role.
4. Edit Role — same as Add but slug is read-only; includes Danger Zone delete link.
5. Delete Confirmation — warns about users that will be reassigned.

== Changelog ==

= 1.0.0 =
* Initial release.
* Role list screen with full role inventory.
* Add/Edit role screen with grouped capability checklist.
* Clone capabilities from existing role.
* Delete role with user reassignment to Subscriber.
* Built-in role protection.
* CSRF nonce on all forms.
* Auto-generated slug from display name.
* Group-level and global capability toggles.
* Mobile-responsive dark-mode-compatible admin UI.
* AddonLogic update system integration.
