/** * * This method return the capability name text if you pass the module_slug & role * It will return proper cap if passed module_key is registered with Rtbiz_Access_Control * & passed role is valid. * * Other wise it will return empty string. * * Example : $module_key = 'rtbiz', $role = 'author' * Return String - rtbiz_author * * @param $module_key * @param string $role * * @return string */ public static function get_capability_from_access_role($module_key, $role = 'no_access') { if (isset(self::$modules[$module_key]) && isset(self::$permissions[$role])) { $module_key = rtbiz_sanitize_module_key($module_key); return $module_key . '_' . $role; } return ''; }
public function module_register($modules) { global $rtbiz_contact, $rtbiz_company; $menu_label = 'rtBiz'; $modules[rtbiz_sanitize_module_key(RTBIZ_TEXT_DOMAIN)] = array('label' => $menu_label, 'post_types' => array($rtbiz_contact->post_type, $rtbiz_company->post_type), 'team_support' => array($rtbiz_contact->post_type), 'product_support' => array($rtbiz_contact->post_type, $rtbiz_company->post_type), 'setting_option_name' => Rtbiz_Setting::$biz_opt, 'setting_page_url' => admin_url('admin.php?page=' . Rtbiz_Setting::$page_slug)); return $modules; }