function wlcms_plugin_deactivate() { include 'admin.config.php'; // Delete all the options that are defined in config foreach ($wlcmsOptions as $opt) { if (isset($opt['id'])) { delete_option($opt['id']); } } wlcmsUpdateCaps(); // Restores other caps back to default // remove editor changes $role = get_role('editor'); $role->remove_cap('switch_themes'); $role->remove_cap('edit_theme_options'); }
function wlcmsSave() { check_admin_referer('wlcms-update_settings'); include 'includes/admin.config.php'; update_option('wlcms_o_ver', WLCMS); foreach ($wlcmsOptions as $value) { if (isset($value['id']) && isset($_REQUEST[$value['id']])) { update_option($value['id'], $_REQUEST[$value['id']]); } elseif (isset($value['id']) && !isset($_REQUEST[$value['id']])) { delete_option($value['id']); } } wlcmsUpdateCaps(); if ($_REQUEST['wlcms_o_editor_template_access'] == "1") { $role = get_role('editor'); $role->add_cap('edit_theme_options'); } elseif ($_REQUEST['wlcms_o_editor_template_access'] == "0") { $role = get_role('editor'); $role->remove_cap('switch_themes'); // Legacy $role->remove_cap('edit_themes'); // Legacy $role->remove_cap('edit_theme_options'); } header("Location: admin.php?page=wlcms-plugin.php&saved=true"); die; }