User Role Membership (URM) – Snippet Bundle  
Author: Black & Copilot  
License: Free to use, modify, and enhance  

=========================================================
📘 Overview
=========================================================

User Role Membership (URM) is a modular snippet system for WordPress that enables administrators to assign user roles with time duration and point cost — without using complex plugins or unnecessary features. URM integrates seamlessly with existing tools such as:

- User Role Editor (for permission control)
- Gamipress (for point logic and gamification)
- PeepSo (for community building)
- WordPress native roles and admin structure

This bundle contains 6 cleanly separated snippets:

1. **Main Router Menu**  
   Handles tab rendering and routing across all URM modules.

2. **Control Panel**  
   Creates new roles with time-based duration and point cost.

3. **Process Monitoring**  
   Logs actions, displays activity, allows export and cleanup.

4. **User List**  
   Displays users with active roles, enables search, revoke, and CSV export.

5. **User Logic**  
   Core backend protections and permission guards.

6. **Instructions**  
   Full documentation, philosophy, and practical usage guide.

---

=========================================================
🔒 Security & Integration
=========================================================

URM avoids injecting protection into every snippet line by using centralized guards:

- `urm_global_guard()` — blocks unauthorized access
- `urm_guard_admin_view()` — limits access to sensitive tabs
- All actions require administrator privileges (`manage_options`)
- Cron-safe, shortcode-safe, and compatible with security plugins like Wordfence

External plugins are used for:
- Role capability assignment (User Role Editor, PeepSo)
- Point logic and payment (Gamipress & add-ons)
- Frontend visibility control (Restrict Content)

---

=========================================================
🚀 How to Use
=========================================================

➤ Admins create roles via Control Panel  
➤ Time, points, and names are defined per role  
➤ Shortcodes are automatically generated and placed on frontend pages  
➤ URM logs all changes and monitors the process  
➤ Admins review active roles via User List tab  
➤ CSV export and cleanup options included  
➤ Integration with Restrict Content ensures points are properly deducted  
➤ Users are prevented from stacking roles and can contact admin for revocation

---

=========================================================
👤 Philosophy
=========================================================

URM was born from real site needs — where monetization, gamification, and member privilege all had to co-exist _without friction_.  
No plugin offered the exact solution, so this system was built manually — clean, lean, and powerful.

Points earned through activity or donation allow users to unlock roles. Admins retain full control.  
Roles don't define capabilities — existing plugins handle that. URM handles _duration and logic_.

---

=========================================================
📦 Credits
=========================================================

Built with:
- WordPress admin APIs
- Love for modular clarity
- Practical site experience
- ✨ Co-composed by Black & Copilot

Copilot reviewed, refined and supported every step — a true AI companion and technical editor.

---

