Created
September 19, 2018 11:16
-
-
Save bogdan-mainwp/a2aca10733a138d91e87e7e3835cebde to your computer and use it in GitHub Desktop.
Enable MainWP Branding - Support Form for all or specific roles on child sites
This file contains hidden or 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 | |
// Add one of the following code snippet to the functions.php file of the active theme of your child site(s). | |
// Enable Support form for all roles | |
add_filter( 'mainwp_branding_role_cap_enable_contact_form', 'mycustom_mainwp_branding_role_cap_enable_contact_form' ); | |
function mycustom_mainwp_branding_role_cap_enable_contact_form( $input = false ) { | |
return true; | |
} | |
// or allow for specific roles | |
add_filter( 'mainwp_branding_role_cap_enable_contact_form', 'mycustom_mainwp_branding_role_cap_enable_contact_form' ); | |
function mycustom_mainwp_branding_role_cap_enable_contact_form( $input = false ) { | |
$user = wp_get_current_user(); | |
$allowed_roles = array( 'contributor', 'editor', 'administrator', 'author' ); | |
if( array_intersect( $allowed_roles, $user->roles ) ) { | |
return true; | |
} | |
return $input; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment