Skip to:
Content
Pages
Categories
Search
Top
Bottom

Adding Register Notice to Admin Bar?

  • I’d like to add some kind of short notice on the admin bar for users that are not logged in. Just a basic “Use this link to register” text.
    How can I go about doing this?

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

  • @mercime
    Participant

    @mercime

    There’s a “Sign Up” link notice in adminbar if you allow registration, beside the “Login” link see http://testbp.org/

    Registration is disabled by default, so if you’re not seeing the Sign Up link, you should go to admin dashboard > Super Admin > Options – Registration Settings – Allow New Registrations – check any other than default “Registration is disabled”

    Edit- for single WP install, go to dashboard > Settings > General Settings – Membership – Anyone can register and below that, you can choose Suscriber role.

    I know how to enable registrations. That’s not my question. I want to put my own message on the bar.


    @mercime
    Participant

    @mercime

    True. I just wanted to clear that up first. So if you want to replace “Sign Up” with what you mentioned above:
    https://codex.buddypress.org/extending-buddypress/customizing-labels-messages-and-urls/

    Sorry, I guess I didn’t make my request clear. Sometimes what I say makes sense to me, but nobody else lol.
    I want to add a message to the admin bar that says “Hey, login with:” and has small icons for facebook and twitter, etc linked to /wp-login.php
    So editing the labels/etc wouldn’t benefit me in this case. Thanks for the help so far though.


    Virtuali
    Participant

    @gunju2221

    Do do this, you might need to go into the BP-core, in Adminbar.php. We can’t write the code that you want to appear, you must write the code that you want to appear in the Admin bar, and add it to the php file.


    @mercime
    Participant

    @mercime

    @Twig
    add this to bp-custom.php file and upload to wp-content/plugins folder

    function custom_adminbar_login() {
    // Your code here
    }
    }
    add_action('bp_adminbar_menus', 'custom_adminbar_login', 1);

    Virtuali
    Participant

    @gunju2221

    or you know, that works too :)

    Merry Christmas! :D

    Sorry, I didn’t respond earlier, but I’ve been out of the country.
    @mercime thanks for the help, but I’m apparently being very dumb.
    Could you possibly throw in an example alternate code? Anything really, doesn’t matter. Everything I try I get:
    Parse error: syntax error, unexpected ‘<' and similar.


    @mercime
    Participant

    @mercime

    No worries, e.g. Adding a link to Dashboard for Site Admin in BP Admin Bar

    function dashboard_link_in_adminbar() {
    if (is_user_logged_in() && is_site_admin()) {
    echo '<li><a href="/wp-admin/">Dashboard</a></li>';
    }
    }
    add_action('bp_adminbar_menus', 'dashboard_link_in_adminbar', 1);

    Raised a ticket on this a while back and gave example code I was using to add dashboard links to adminbar and believe there has been a patch added and committed for 1.3.

    Yea, still not working right for me. I can get it to display, but it only displays the message for logged in users. Anyone logged out it just has the normal login/sign up links.


    @mercime
    Participant

    @mercime

    Thanks @hnla good to know. Been using above code for a long time, was too lazy to type /wp-admin :-)

    @twig what code did you add that’s not working?

    I added exactly what you posted into my bp-custom file. It only displays for logged in users though. My bar will still display for logged out users, but not the custom message.


    @mercime
    Participant

    @mercime

    What I posted was an example of adding a link to the adminbar, in this case, the Dashboard link for a Super Admin only, not for your specific scenario. Assuming you didn’t change the registration slug, it would be something like this

    function register_link_adminbar() {
    if (!is_user_logged_in()) {
    echo '<li><a href="/register/">Use this link to register</a></li>';
    }
    }
    add_action('bp_adminbar_menus', 'register_link_adminbar', 2);

    Adjust as needed.

    Ok, I see what’s different now. Thanks for the help!

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Adding Register Notice to Admin Bar?’ is closed to new replies.
Skip to toolbar