%s

', esc_html__('Aikon Role Manager requires PHP 8.0 or higher.', 'aikon-role-manager') ); }); exit; } define('AIKON_ROLE_MANAGER_VERSION', '1.1.1'); define('AIKON_ROLE_MANAGER_PATH', plugin_dir_path(__FILE__)); define('AIKON_ROLE_MANAGER_URL', plugin_dir_url(__FILE__)); define('AIKON_ROLE_MANAGER_TEMPLATE_PATH', AIKON_ROLE_MANAGER_PATH . 'templates'); require_once __DIR__ . '/vendor/autoload.php'; use Aikon\RoleManager\Manager\PostTypeManager; use Aikon\RoleManager\OptionsPage\OptionsPage; use Aikon\RoleManager\OptionsPage\Tabs\CapabilitiesTab; use Aikon\RoleManager\OptionsPage\Tabs\PostTypesTab; use Aikon\RoleManager\OptionsPage\Tabs\RolesTab; use Aikon\RoleManager\OptionsPage\Tabs\SettingsTab; use Aikon\RoleManager\UserProfile\UserProfileEdit; use Aikon\RoleManager\UserSwitcher\UserSwitcher; /** Apply post type capability overrides before post types register on init */ add_action('plugins_loaded', function () { PostTypeManager::getInstance()->apply_overrides(); }); /** Register the UserSwitcher */ add_action('plugins_loaded', function () { new UserSwitcher(); }); /** Register the Options page and pass the RoleManager with a config */ add_action('admin_menu', function () { new OptionsPage([ new RolesTab(), new CapabilitiesTab(), new PostTypesTab(), new SettingsTab(), ]); new UserProfileEdit(); }, 10); /** * When site is multisite the super_admin has the multisite_capabilities, * if not multisite there should be no super_admin role and the administrator * should have the multisite_capabilities */ add_filter('aikon_role_manager_config', function ($config) { if (is_multisite()) { $config['default_capabilities']['super_admin'] = array_merge( $config['default_capabilities']['super_admin'], $config['multisite_capabilities'] ); } else { $config['default_capabilities']['administrator'] = array_merge( $config['default_capabilities']['administrator'], $config['multisite_capabilities'] ); } return $config; }, 10, 1); /** Deactivation hook to clean up plugin data */ register_deactivation_hook(__FILE__, function () { // Clear post type overrides delete_option('aikon_post_type_capability_overrides'); // Clear capabilities delete_option('aikon_role_manager_settings'); });