Skip to:
Content
Pages
Categories
Search
Top
Bottom

Add a welcome message to admin bar instead of website name

  • When a user is logged in, what I would like to happen instead of the site’s name, is a welcome message, such as “welcome %username” or howdy %%” Like this:

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

  • Bigjimmysisco
    Member

    @bigjimmysisco

    +1!!!

    I give it a +1 too

    Anybody???


    Nahum
    Participant

    @nahummadrid

    i’d try removing the logo something like this in your functions.php or bp-custom.php…

    remove_action( ‘bp_adminbar_logo’, ‘bp_adminbar_logo’ );

    …and try applying your welcome message start here & here:

    https://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/modifying-the-buddypress-admin-bar-not-working-in-bp-customphp/
    https://codex.buddypress.org/theme-development/modifying-the-buddypress-admin-bar/

    I need the logo when the user is logged out, but when logged in, i need ^^ in the picture above.

    Im confused!

    I would love to just add a function to the bp-custom and not edit the core files


    Nahum
    Participant

    @nahummadrid

    yup that’s what you would be doing with the links above. it just takes some reading through.

    Links? The links you provided linked me to a codex do_action hook page, which is nothing I want. I don’t need hooks.

    2nd link links to a core edit file? Well..


    @mercime
    Keymaster

    @mercime

    == The links you provided linked me to a codex do_action hook page, which is nothing I want. I don’t need hooks.==

    @espeon the information contained in linked documents given by @nahummadrid may be nothing you want but those are what you need in order to modify the adminbar. No reason for sarcasm.


    Virtuali
    Participant

    @gunju2221

    function add_welcome_message() {
    global $current_user;
    get_currentuserinfo();
    $author = $current_user->display_name;
    if ( is_user_logged_in() ) {
    echo "
    <li>Welcome <strong>" . $author . "</strong></li>
    
    ";
    echo '
    <li><a href="' . wp_logout_url( site_url() ) . '">' . __( 'Log Out', 'buddypress' ) . '</a></li>
    
    ';
    } else {
    echo "
    <li>Welcome <strong>Guest</strong></li>
    
    ";
    }
    }
    add_action( 'bp_adminbar_menus', 'add_welcome_message', 15 );
    

    Add in the remove_action( ‘bp_adminbar_logo’, ‘bp_adminbar_logo’ ); if you wish.

    @espeon
    If you had actually read that codex page in the second link without dismissing it as not what you wanted (what did you want? I suspect what has been offered above!) then you would have noted this line:
    We’re going to modify the ‘My Blogs’ menu without changing the core code

    Operative words there are “without changing core code”

    When you come to a tech forum that offers help you need to bear in mind that the prerequisite to gaining that help is that you demonstrate a willingness to get involved and to be seen to help your self as much as possible; please do not think that on a voluntary help forum that there is any obligation to help people it’s a co-operative process, and attitude of any sorts is never taken well! :)

    You now have a function that looks on the surface to do what you require, and which you now test by adding to your functions file in your theme.

    it’s important though that because some code has been provided that this isn’t perceived as the norm or that the forum is a coding service – the provision of code in this manner is up to each and every member to decide if they wish to provide and often it will be but it mustn’t be taken for granted.

    @gunju2221, Very nice!!!! You even added the nice “welcome guest” when logged out! :D Thanks a bunch!

    @hnla as i read like the first 2 sentences of ur post it sounded like a duck dying in my head. Go and be a therapist somewhere else please :D

    @espeon I’m a forum moderator, what forums have you been frequenting where it’s acceptable to pass a comment like that to regular members let alone a site moderator. Passing comments like that get noticed and you will find that there will an unwillingness to help in future so I would advise against further comments like that as they will not help your case regardless of what may have prompted them.

    All said in a very friendly advisory manner my young friend :)

    Topic locked.

    @espeon Play nice.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Add a welcome message to admin bar instead of website name’ is closed to new replies.
Skip to toolbar