1

I want to hide the button to create new discussions within a group and I have managed to do it through the Wordpress roles with the code you see below, but I would like to do it with the role of Buddypress. I want to hide the button for those who have the role of "Members"

These are the roles: https://codex.buddypress.org/administrator-guide/group-settings-and-roles/

Thank you!

add_action( 'wp_enqueue_scripts', 'wholesale_customer_logo' );
function wholesale_customer_logo(){
    if( in_array( 'customer', (array) wp_get_current_user()->roles ) || in_array( 'subscriber', (array) wp_get_current_user()->roles )  ){
        echo '<style>
            .button.btn-new-topic {
                display:none!important;}
        </style>';
    }
}

Tried with in_array( 'member', (array) wp_get_current_user()->roles ) but it doesn't work.

Gervasio
  • 11
  • 2
  • Have you tried adding another check for `in_array( 'member', (array) wp_get_current_user()->roles )`? Seems pretty straightforward. – disinfor Sep 25 '19 at 13:12
  • @disinfor Doesn't work :( – Gervasio Sep 25 '19 at 13:32
  • Edit your question to show how you tried it. As of right now, your question shows what works, but doesn't show what you've tried to make it work. – disinfor Sep 25 '19 at 13:33

0 Answers0