Skip to:
Content
Pages
Categories
Search
Top
Bottom

Change Login & Register Links in Admin Bar

Viewing 3 replies - 1 through 3 (of 3 total)
  • @webplayer

    Participant

    I stumbled upon this post suggesting a snippet to put into bp-custom.php (a tweaks and snippets file for buddy press located in the plugins directory), but I can’t get it to work. I think there is an issue with my coding.

    I am using BuddyPress 2.1.1

    Here is my bp-custom.php file:

    <?php
    // hacks and mods will go here
    
    //Change Admin Bar Login Links
    function custom_bp_adminbar_login_menu() {
        global $bp;
        global $wp;
        remove_action('bp_adminbar_menus', 'bp_adminbar_login_menu', 2);
        if (is_user_logged_in())
            return false;
        echo '<li class="bp-login no-arrow"><a data-reveal-id="tmpl_reg_login_container" href="javascript:void(0);" onClick="tmpl_login_frm();">' . __('Log In', 'buddypress') . '</a></li>';
        // Show "Sign Up" link if user registrations are allowed
        if (bp_get_signup_allowed()) {
            echo '<li class="bp-signup no-arrow"><a data-reveal-id="tmpl_reg_login_container" href="javascript:void(0);" onClick="tmpl_registretion_frm();">' . __('Sign Up', 'buddypress') . '</a></li>';
        }
    }
    
    add_action('bp_adminbar_menus', 'custom_bp_adminbar_login_menu', 1);
    
    ?>

    @webplayer

    Participant

    I am not a coder, but I’m looking for a snippet that can do this:

    Add Function: Change Admin Bar Login and Register Links
    
    if user is logged out
    
    Remove WordPress/buddypress admin bar Login and Register links
    
    Add New Login and Register Links
    
    New Login Link: <a data-reveal-id="tmpl_reg_login_container" href="javascript:void(0);" onclick="tmpl_login_frm();">New Login Link</a>
    
    New Register Link: <a data-reveal-id="tmpl_reg_login_container" href="javascript:void(0);" onclick="tmpl_registretion_frm();">New Register Link</a>
    
    if user is logged in don't do any of the above (i.e.) show their buddypress username and hide register links, etc...
    

    Does anyone know how to make this happen in code that I can drop into functions.php or bp-custom.php

    @djsteveb

    Participant

    I use the plugin “custom admin bar” to do this ( https://wordpress.org/plugins/custom-admin-bar/ ) (with a wp/bp site)

    There are a ton of admin bar plugins in the wp plugin repo – certainly a few of them can handle this without getting into code?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change Login & Register Links in Admin Bar’ is closed to new replies.
Skip to toolbar