Multisite global header – branding and functions

Hi,

I’m sorry if this question is redundant. I’ve browsed existing resources but didn’t find a clear answear.

My goal is to build an open registration multisite network for my users. I want to let them choose from a selection of themes, but to keep the site “browsable” I want to use a global header to link between blogs and the homepage. But I also want to use this space for functions useful to logged in users, replacing the admin header bar. For tests I have used your excellent Ultimate branding plug-in but this only lets me insert static html of course. The question is – what is the best way to create a global network wide header that would consist of some static elements and a few dynamic ones – specifically – login/logout/register buttons, search field, wp-admin link for logged in user etc…

Thanks

  • Alexander
    • DEV MAN’s Mascot

    Hi @janslu,

    I think the best way to do this would be to force the WordPress toolbar to show across all sites. Ultimate Branding will allow you to change the toolbar logo as well. You can force this with a bit of custom code, or a plugin like this one: http://wordpress.org/plugins/always-show-admin-bar/

    In fact, this is how we’ve done it on Edublogs: http://edublogs.org

    There are other ways to customize the toolbar as well with plugins.

    Ultimate Branding also has the ability to add custom menu items.

    Best regards,

  • janslu
    • Flash Drive

    I took it a little further but found a problem.

    After searching the internet I’ve found a way to build an admin bat using mu-plugins code:

    <?php
    function pjw_login_adminbar( $wp_admin_bar) {
    if ( !is_user_logged_in() )
    $wp_admin_bar->add_menu( array( 'title' => __( 'Log In' ), 'href' => wp_login_url() ) );
    }
    function custom_adminbar_menu( $meta = TRUE ) {
    global $wp_admin_bar;
    if ( is_user_logged_in() ) { return; }
    if ( !is_admin_bar_showing() ) { return; }
    $wp_admin_bar->add_menu( array(
    'id' => 'Register',
    'title' => __( 'Register' ),
    'href' => ust_wpsignup_url(),//wp_registration_url() before anti-splog
    )
    );
    }

    add_action( 'admin_bar_menu', 'pjw_login_adminbar' );
    add_action( 'admin_bar_menu', 'custom_adminbar_menu', 15 );
    add_filter( 'show_admin_bar', '__return_true' , 1000 );
    ?>

    But ust_wpsignup_url() is empty. Is it because mu-plugins are executed before everything else? What is the best solution to have the admin bar always on (no matter the login / theme etc) and have a proper anti-splog link?

  • Alexander
    • DEV MAN’s Mascot

    Hi @janslu,

    Nice code there! I don’t think the problem is that AntiSplog hasn’t loaded yet because you’re calling this in an action filter. This means that execution has already been delayed quite some time – enough for other plugins to become ready

    Have you set that slug in Anti Splog settings? With WP_DEBUG mode enabled, do you get any error messages?

    Best regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.