Remove unnecessary utility functions
This commit is contained in:
parent
8db3222141
commit
9e12a572a7
@ -625,7 +625,8 @@ if ( ! current_user_can( 'edit_post_tags' ) && ! current_user_can( 'manage_optio
|
||||
|
||||
function fictioneer_remove_sub_menus() {
|
||||
// Setup
|
||||
$user_caps = fictioneer_get_user_caps();
|
||||
$current_user = wp_get_current_user();
|
||||
$user_caps = array_keys( array_filter( $current_user->allcaps ) );
|
||||
$taxonomies = ['category', 'post_tag', 'fcn_genre', 'fcn_fandom', 'fcn_character', 'fcn_content_warning'];
|
||||
$post_types = ['post', 'page', 'fcn_story', 'fcn_chapter', 'fcn_collection', 'fcn_recommendation'];
|
||||
|
||||
|
@ -1874,37 +1874,4 @@ if ( ! function_exists( 'fictioneer_verify_preview_access' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// GET ALL CAPABILITIES OF USER
|
||||
// =============================================================================
|
||||
|
||||
/**
|
||||
* Retrieves all capabilities of a given user based on their roles
|
||||
*
|
||||
* @param WP_User|null $user The user object whose capabilities are to be retrieved.
|
||||
* Defaults to the current user if not provided.
|
||||
*
|
||||
* @return array An array of capability strings.
|
||||
*/
|
||||
|
||||
function fictioneer_get_user_caps( $user = null ) {
|
||||
// Setup
|
||||
$user = $user ? $user : wp_get_current_user();
|
||||
|
||||
if ( ! $user->exists() ) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$user_caps = [];
|
||||
$roles = $user->roles;
|
||||
|
||||
// Collect capabilities from all roles
|
||||
foreach( $roles as $role ) {
|
||||
$user_caps = array_merge( $user_caps, get_role( $role )->capabilities );
|
||||
}
|
||||
|
||||
// Return result
|
||||
return array_keys( $user_caps );
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -728,14 +728,14 @@
|
||||
|
||||
<div class="card">
|
||||
<div class="card-wrapper">
|
||||
<h3 class="card-header"><?php _e( 'Security & Privacy', 'fictioneer' ) ?></h3>
|
||||
<h3 class="card-header"><?php _e( 'Security & Privacy', 'fictioneer' ); ?></h3>
|
||||
<div class="card-content">
|
||||
|
||||
<label for="fictioneer_do_not_save_comment_ip" class="label-wrapped-checkbox row">
|
||||
<input name="fictioneer_do_not_save_comment_ip" type="checkbox" id="fictioneer_do_not_save_comment_ip" <?php echo checked( 1, get_option( 'fictioneer_do_not_save_comment_ip' ), false ); ?> value="1">
|
||||
<div>
|
||||
<span><?php echo FICTIONEER_OPTIONS['booleans']['fictioneer_do_not_save_comment_ip']['label']; ?></span>
|
||||
<p class="sub-label"><?php _e( 'IP addresses are personal data.', 'fictioneer' ) ?></p>
|
||||
<p class="sub-label"><?php _e( 'IP addresses are personal data.', 'fictioneer' ); ?></p>
|
||||
</div>
|
||||
</label>
|
||||
|
||||
@ -743,7 +743,7 @@
|
||||
<input name="fictioneer_restrict_rest_api" type="checkbox" id="fictioneer_restrict_rest_api" <?php echo checked( 1, get_option( 'fictioneer_restrict_rest_api' ), false ); ?> value="1">
|
||||
<div>
|
||||
<span><?php echo FICTIONEER_OPTIONS['booleans']['fictioneer_restrict_rest_api']['label']; ?></span>
|
||||
<p class="sub-label"><?php _e( 'Disables API for guests and low-permission users.', 'fictioneer' ) ?></p>
|
||||
<p class="sub-label"><?php _e( 'Disables API for guests and low-permission users.', 'fictioneer' ); ?></p>
|
||||
</div>
|
||||
</label>
|
||||
|
||||
@ -751,7 +751,7 @@
|
||||
<input name="fictioneer_disable_application_passwords" type="checkbox" id="fictioneer_disable_application_passwords" <?php echo checked( 1, get_option( 'fictioneer_disable_application_passwords' ), false ); ?> value="1">
|
||||
<div>
|
||||
<span><?php echo FICTIONEER_OPTIONS['booleans']['fictioneer_disable_application_passwords']['label']; ?></span>
|
||||
<p class="sub-label"><?php _e( 'If you do not need them, you should disable them.', 'fictioneer' ) ?></p>
|
||||
<p class="sub-label"><?php _e( 'If you do not need them, you should disable them.', 'fictioneer' ); ?></p>
|
||||
</div>
|
||||
</label>
|
||||
|
||||
@ -759,7 +759,7 @@
|
||||
<input name="fictioneer_logout_redirects_home" type="checkbox" id="fictioneer_logout_redirects_home" <?php echo checked( 1, get_option( 'fictioneer_logout_redirects_home' ), false ); ?> value="1">
|
||||
<div>
|
||||
<span><?php echo FICTIONEER_OPTIONS['booleans']['fictioneer_logout_redirects_home']['label']; ?></span>
|
||||
<p class="sub-label"><?php _e( 'Prevents users from ending up on the login page.', 'fictioneer' ) ?></p>
|
||||
<p class="sub-label"><?php _e( 'Prevents users from ending up on the login page.', 'fictioneer' ); ?></p>
|
||||
</div>
|
||||
</label>
|
||||
|
||||
@ -767,7 +767,15 @@
|
||||
<input name="fictioneer_consent_wrappers" type="checkbox" id="fictioneer_consent_wrappers" <?php echo checked( 1, get_option( 'fictioneer_consent_wrappers' ), false ); ?> value="1">
|
||||
<div>
|
||||
<span><?php echo FICTIONEER_OPTIONS['booleans']['fictioneer_consent_wrappers']['label']; ?></span>
|
||||
<p class="sub-label"><?php _e( 'External content not loaded until deliberately clicked.', 'fictioneer' ) ?></p>
|
||||
<p class="sub-label"><?php _e( 'External content not loaded until deliberately clicked.', 'fictioneer' ); ?></p>
|
||||
</div>
|
||||
</label>
|
||||
|
||||
<label for="fictioneer_see_some_evil" class="label-wrapped-checkbox row">
|
||||
<input name="fictioneer_see_some_evil" type="checkbox" id="fictioneer_see_some_evil" <?php echo checked( 1, get_option( 'fictioneer_see_some_evil' ), false ); ?> value="1">
|
||||
<div>
|
||||
<span><?php echo FICTIONEER_OPTIONS['booleans']['fictioneer_see_some_evil']['label']; ?></span>
|
||||
<p class="sub-label"><?php _e( 'Sends an admin email if suspicious strings are found, which could be an attempted attack or <strong>false positive.</strong>', 'fictioneer' ); ?></p>
|
||||
</div>
|
||||
</label>
|
||||
|
||||
@ -775,7 +783,7 @@
|
||||
<input name="fictioneer_cookie_banner" type="checkbox" id="fictioneer_cookie_banner" <?php echo checked( 1, get_option( 'fictioneer_cookie_banner' ), false ); ?> value="1">
|
||||
<div>
|
||||
<span><?php echo FICTIONEER_OPTIONS['booleans']['fictioneer_cookie_banner']['label']; ?></span>
|
||||
<p class="sub-label"><?php _e( "Shows a generic cookie consent banner and activates the <code>fictioneer_get_consent()</code> theme function that returns either false, \"necessary\", or \"full\".", 'fictioneer' ) ?></p>
|
||||
<p class="sub-label"><?php _e( "Shows a generic cookie consent banner and activates the <code>fictioneer_get_consent()</code> theme function that returns either false, \"necessary\", or \"full\".", 'fictioneer' ); ?></p>
|
||||
</div>
|
||||
</label>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user