Guest User

Untitled

a guest
Sep 19th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. <?php
  2.  
  3. // Add one of the following code snippet to the functions.php file of the active theme of your child site(s).
  4.  
  5. // Enable Support form for all roles
  6. add_filter( 'mainwp_branding_role_cap_enable_contact_form', 'mycustom_mainwp_branding_role_cap_enable_contact_form' );
  7. function mycustom_mainwp_branding_role_cap_enable_contact_form( $input = false ) {
  8. return true;
  9. }
  10.  
  11. // or allow for specific roles
  12. add_filter( 'mainwp_branding_role_cap_enable_contact_form', 'mycustom_mainwp_branding_role_cap_enable_contact_form' );
  13. function mycustom_mainwp_branding_role_cap_enable_contact_form( $input = false ) {
  14. $user = wp_get_current_user();
  15. $allowed_roles = array( 'contributor', 'editor', 'administrator', 'author' );
  16. if( array_intersect( $allowed_roles, $user->roles ) ) {
  17. return true;
  18. }
  19. return $input;
  20. }
  21.  
  22. ?>
Add Comment
Please, Sign In to add comment