testing progress

This commit is contained in:
2025-08-12 10:36:32 -07:00
parent 1633eb46df
commit f6429110e5
3 changed files with 22 additions and 14 deletions

View File

@@ -67,8 +67,9 @@ class TWP_Core {
* Ensure custom user roles exist
*/
private function ensure_user_roles() {
// Check if the phone_agent role exists
if (!get_role('phone_agent')) {
$role = get_role('phone_agent');
if (!$role) {
// Create the Phone Agent role with limited capabilities
add_role('phone_agent', 'Phone Agent', array(
// Basic WordPress capabilities
@@ -84,7 +85,13 @@ class TWP_Core {
'twp_access_outbound_calls' => true,
'twp_access_sms_inbox' => true,
'twp_access_browser_phone' => true,
'twp_access_phone_numbers' => true,
));
} else {
// Update existing role with any missing capabilities
if (!$role->has_cap('twp_access_phone_numbers')) {
$role->add_cap('twp_access_phone_numbers');
}
}
}