Skip to content

Instantly share code, notes, and snippets.

@bogdan-mainwp
Created September 19, 2018 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bogdan-mainwp/a2aca10733a138d91e87e7e3835cebde to your computer and use it in GitHub Desktop.
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
<?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