Created
October 3, 2019 17:00
-
-
Save bogdan-mainwp/ae356a1670633ea103b8ddbcbc176630 to your computer and use it in GitHub Desktop.
Hide custom branding for certain user
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 | |
// Hide custom branidng for the user with specific ID | |
// Replace ID with actual ID number | |
add_filter( 'mainwp_child_branding_init_options', 'mycustom_mainwp_child_branding_init_options' ); | |
function mycustom_mainwp_child_branding_init_options( $option ) { | |
$current_user_id = get_current_user_id(); | |
if ( $current_user_id == 'ID' && is_array( $option ) && isset( $option[ 'cancelled_branding' ] ) ) { | |
$option[ 'cancelled_branding' ] = true; | |
} | |
return $option; | |
} | |
// Hide custom branidng for the user with specific username | |
// Replace USERNAME with actual username | |
add_filter( 'mainwp_child_branding_init_options', 'mycustom_mainwp_child_branding_init_options' ); | |
function mycustom_mainwp_child_branding_init_options( $option ) { | |
$current_user = wp_get_current_user(); | |
if ( $current_user && $current_user->user_login == 'USERNAME' && is_array( $option ) && isset( $option[ 'cancelled_branding' ] ) ) { | |
$option[ 'cancelled_branding' ] = true; | |
} | |
return $option; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment