Skip to:
Content
Pages
Categories
Search
Top
Bottom

Deactivate the adminbar per blog

  • Avatar of pushi22le
    pushi22le
    Participant

    @pushi22le

    I want that the users can deactivate the adminbar in their blogs but not globally. Is it possible?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Avatar of jamesatwholelifewholeworld
    JamesatWholeLifeWholeWorld
    Participant

    @jamesatwholelifewholeworld

    Yeah, that would be ideal.

    James

    Avatar of pushi22le
    pushi22le
    Participant

    @pushi22le

    I found this plugin http://wordpress.org/extend/plugins/remove-buddypress-adminbar/

    I also copied and edited the plugin to deactivate the bar just for guests. Here is the code:

    <?php

    /*

    Plugin Name: Remove BuddyPress AdminBar For Guests

    Plugin URI: http://blog.netweblogic.com/php/wordpress-php/remove-admin-bar-plugin/

    Description: This plugin removes the admin bar completely from the public area of the website just for guests. Can be used either as a normal or MU plugin.

    Author: NetWebLogic LLC

    Version: 1.2

    Author URI: http://blog.netweblogic.com

    */

    if ( !function_exists(‘remove_bp_adminbar_guests’) ) {

    function remove_bp_adminbar_guests() {

    if (!is_user_logged_in()) {

    remove_action( ‘wp_footer’, ‘bp_core_admin_bar’, 8 );

    remove_action( ‘wp_head’, ‘bp_core_admin_bar_css’, 1 );

    function bp_core_override_adminbar_css_perblog() {

    ?>

    <style type=”text/css”>body { padding-top: 0 !important; } #wp-admin-bar { display: none; }</style>

    <?php

    }

    add_action( ‘wp_footer’, ‘bp_core_override_adminbar_css’ );

    }

    }

    }

    // Start this plugin once all other plugins are fully loaded

    add_action( ‘plugins_loaded’, ‘remove_bp_adminbar_guests’ );

    ?>

    So the bloggers have two options, they can deactivate the bar only for guests or also for the registered users.

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

You must be logged in to reply to this topic.