function wpcf7_map_meta_cap($meta_caps) { /* Prevent infinite loop triggered by current_user_can('webmaster') */ remove_filter('wpcf7_map_meta_cap', array($this, 'wpcf7_map_meta_cap')); if (empty($this->section['fields']['0']['default'])) { return $meta_caps; } if (!TD_WebmasterUserRole::current_user_is_webmaster()) { return $meta_caps; } global $webmaster_user_role_config; if (!is_array($webmaster_user_role_config)) { return $meta_caps; } if (!isset($webmaster_user_role_config['webmaster_caps_cf7'])) { return $meta_caps; } if (!$this->is_active()) { return $meta_caps; } foreach ($this->section['fields']['0']['default'] as $cap => $default_value) { $value = isset($webmaster_user_role_config['webmaster_caps_cf7'][$cap]) ? $webmaster_user_role_config['webmaster_caps_cf7'][$cap] : $default_value; if (!empty($value)) { $meta_caps[$cap] = 'webmaster'; } else { $meta_caps[$cap] = 'administrator'; } } return $meta_caps; }
function remove_adminstrator_from_editable_roles($roles) { if (!TD_WebmasterUserRole::current_user_is_webmaster()) { return $roles; } if (isset($roles['administrator'])) { unset($roles['administrator']); } return $roles; }
function admin_menu() { if (!TD_WebmasterUserRole::current_user_is_webmaster()) { return; } global $webmaster_user_role_config; if (is_array($webmaster_user_role_config) && empty($webmaster_user_role_config['webmaster_wpai_metabox_settings']['wpai_settings'])) { remove_menu_page('pmxi-admin-home'); } }
function admin_menu() { if (!TD_WebmasterUserRole::current_user_is_webmaster()) { return; } global $webmaster_user_role_config; if (is_array($webmaster_user_role_config) && empty($webmaster_user_role_config['webmaster_sgcachepress_metabox_settings']['sgcachepress_settings'])) { remove_menu_page('sg-cachepress'); } }
function admin_menu() { if (!TD_WebmasterUserRole::current_user_is_webmaster()) { return; } global $webmaster_user_role_config; if (is_array($webmaster_user_role_config) && empty($webmaster_user_role_config['webmaster_yoast_metabox_settings']['yoast_settings'])) { remove_menu_page('wpseo_dashboard'); } }
function admin_menu() { if (!$this->is_active()) { return; } if (!TD_WebmasterUserRole::current_user_is_webmaster()) { return; } global $webmaster_user_role_config; if (!(is_array($webmaster_user_role_config) && isset($webmaster_user_role_config['webmaster_admin_menu_acf']['acf_menu']) && !empty($webmaster_user_role_config['webmaster_admin_menu_acf']['acf_menu']))) { remove_menu_page('edit.php?post_type=acf'); remove_menu_page('edit.php?post_type=acf-field-group'); } }
function modify_itsec_globals() { if (!$this->is_active()) { return; } if (!TD_WebmasterUserRole::current_user_is_webmaster()) { return; } global $webmaster_user_role_config; if (!empty($webmaster_user_role_config['webmaster_itsec']['itsec_settings'])) { return; } global $itsec_globals; $itsec_globals['plugin_access_lvl'] = 'administrator'; /* Hide update/what's new nag (for some reason this isn't linked to the plugin_access_lvl) */ $itsec_globals['data']['setup_completed'] = true; }
function set_webmaster_cap($capability) { if (TD_WebmasterUserRole::current_user_is_webmaster()) { global $webmaster_user_role_config; if (is_array($webmaster_user_role_config)) { $current_filter = current_filter(); $current_cap = str_replace(array('FHEE_', '_capability'), '', $current_filter); if ($current_cap == 'management') { $current_cap = 'espresso_events'; // The top-level "management cap" is the same as the Events submenu } if (!isset($webmaster_user_role_config['webmaster_event_espresso_settings'][$current_cap])) { $webmaster_user_role_config['webmaster_event_espresso_settings'][$current_cap] = $this->section['fields']['0']['default'][$current_cap]; } if ((int) $webmaster_user_role_config['webmaster_event_espresso_settings'][$current_cap]) { return 'webmaster'; } } } return $capability; }