Created
February 7, 2014 20:03
-
-
Save joshuadavidnelson/8870655 to your computer and use it in GitHub Desktop.
Force Genesis admin settings for admin, display genesis admin menu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Force Genesis Admin Settings for all administrators | |
**/ | |
// Force Genesis on Admin | |
add_action( 'admin_init', 'jdn_force_genesis_admin' ); | |
function jdn_force_genesis_admin() { | |
if( current_user_can( 'create_users' ) ) { // If this is an Admin | |
$user_id = get_current_user_id(); | |
if ( !get_user_meta( $user_id, 'genesis_admin_menu', true ) ) // See the Genesis Admin Menu | |
update_user_meta( $user_id, 'genesis_admin_menu', 1 ); | |
if ( !get_user_meta( $user_id, 'genesis_seo_settings_menu', true ) ) // See the SEO settings menu | |
update_user_meta( $user_id, 'genesis_seo_settings_menu', 1 ); | |
if ( !get_user_meta( $user_id, 'genesis_import_export_menu', true ) ) // See the Import-Export menu | |
update_user_meta( $user_id, 'genesis_import_export_menu', 1 ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comes in handy when you want to remove the options from the user profile, but want to make sure they don't reset - then you can't see the Genesis Admin menu and you can't update your options...