NerdEnPose (@nerdenpose)

Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • In reply to: Remove search bar

    NerdEnPose
    Participant

    @nerdenpose

    This is the basic code. There’s plugins to do it but I prefer to put this in my functions.php

    add_action('init', 'remove_admin_bar');
    
    function remove_admin_bar() {
            show_admin_bar(false);
    }

    However I prefer to only remove it if the user isn’t logged in:

    add_action('init', 'remove_admin_bar');
    
    function remove_admin_bar() {
        if (!is_user_logged_in()) {
            show_admin_bar(false);
        }
    }

    Or if you prefer to limit by user roles and editing capabilities.

    function remove_admin_bar() {
        if (!current_user_can('administrator')) {
            show_admin_bar(false);
        }
    }

    FYI: There’s a pretty popular search result recommending this for role check:

    add_action('init', 'remove_admin_bar');
    
    function remove_admin_bar() {
    if (!current_user_can('administrator') && !is_admin()) {
      show_admin_bar(false);
    }
    }

    This would check to see if the user is in the admin portion in which case you’d show the bar as well.


    NerdEnPose
    Participant

    @nerdenpose

    I’m using 2.3.2 and this is my solution.

    There’s a function in the theme files calling this, simply noting it out or deleting it prevents the call.

    // bbp_single_topic_description();
    content-single-topic.php

    and

    // bbp_single_topic_description( array( 'topic_id' => bbp_get_topic_id() ) );
    form-topic.php

    This makes more sense to me because why generate the HTML just to bloat your CSS file to hide it? Or why add more to your functions.php file when all you need to do is some basic theme work? (Although that was some clever hacking of the wordpress/bbpress hooks there mindyjoy :))

    *Make sure to move all your theme files into your wordpress theme (wp-includes/themes/your_theme/buddypress/) so you don’t lose your work with an upgrade.

Viewing 2 replies - 1 through 2 (of 2 total)