Skip to:
Content
Pages
Categories
Search
Top
Bottom

Adding menu items to the admin bar


  • Jens Wedin
    Participant

    @jedisthlm

    Others have asked, but I haven’t found an easy solution to make dropdown menu items from my pages and post categories in the Buddypress admin bar? I want to use the bar as my main navigation menu.

Viewing 25 replies - 26 through 50 (of 79 total)
  • @alanchrishughes: when I reread that, I wondered if you meant that your code adds a second admin bar. If that’s the case, then that’s not really what I’m after :(

    Trying out @JediSthlm‘s bp-custom.php code, but keep getting UNEXPECTED “:” errors about my giant “if” line here (the one about logged in, is_single, and tags):

    http://pastebin.com/brUAWfr6

    I took the “:” out of the line completely, and then it gave me an UNEXPECTED “;” error, even though there was no semicolon in the line.

    Anyone know what’s wrong with my code? I’m sorry, it’s indented properly in my editor, I don’t know why it ended up like that in the pastebin :P

    Eep! Nevermind, I figured it out. I was missing an ending parenthesis :)


    alanchrishughes
    Participant

    @alanchrishughes

    @justbishop Well I hope you got everything figured out and working :)

    What I was suggesting is just something I am working on, not to create two admin bars, but to remove the old one and create a setup that allows you to design it into your theme however you want.

    @alanchrishughes: I see now :)

    That should be interesting if you can get the login stuff working!


    alanchrishughes
    Participant

    @alanchrishughes

    @justbishop I’ve had the login stuff working for a while now, clumsily got the notifications working, but all the links under the “My Account” tab are a mystery to me :(

    @alanchrishughes: could you not hardcode everything but the Log Out in that menu? I thought all of those items had actual URLs, they just each include the current logged in user’s @user name. You could grab that by using bp_displayed_user_username() in the link with the rest hardcoded, couldn’t you?

    It’s a bit janky and static, but it might work…unless I’m just completely not thinking straight at the moment (which is entirely possible!)


    alanchrishughes
    Participant

    @alanchrishughes

    @justbishop Are you saying it might be possible to write something like

    a href= members/bp_displayed_user_username()/profile/change-avatar

    @alanchrishughes: Yep, I use the following in member-header.php on my site for the link to the feedback posts (which are titled with the @user name of each member):

    href=”http://www.clothunderground.com/feedback/bp_displayed_user_username();/” title=”View or leave feedback for this user”

    Worth a try!

    ETA: of course, you’d need the php open/close pieces around that bp_displayed_user_username(); tag :P


    alanchrishughes
    Participant

    @alanchrishughes

    @justbishop the <?php things right? I really am a newb when it comes to php :(

    @alanchrishughes: Me too, lol!

    I pastebinned this for you. Might work, might not. It’s only a link for the “Activity” page. I’m not sure how you’d go about coding the menu that appears to the side of it (the one with “Personal”, “Friends”, “Groups”, etc.), but at least this may give you a start :)

    http://pastebin.com/LAa0FcEi


    alanchrishughes
    Participant

    @alanchrishughes

    @justbishop that seems to be working only if you are on your own member page. Other wise it just shows members//activity

    @alanchrishughes: Well crap :(

    Oooh, is there a tag you can use on sidebar.php? There must be something there, because there’s a link to the logged in user’s profile that’s displayed in the sidebar on every page. That’s where I’d check next.

    I couldn’t help myself, I had to go look. Try this:

    http://pastebin.com/M0Gvkp0N


    catchit
    Participant

    @catchit

    Anyone know how to put drop-down menu on the normal menu bar, I can’t seem to figure out how. Even if its just manual coding…


    paulhastings0
    Participant

    @paulhastings0

    @pcwriter I’m looking forward to your plugin.


    alanchrishughes
    Participant

    @alanchrishughes

    @justbishop well I’m just playing around with this at work when I should be working, but it seems like this is working for all the user pages.

    http://pastebin.com/7QFJ5fUV

    I don’t know why I didn’t think to look at that sidebar thing a long time ago =P

    Ah, yeah, I wasn’t sure if the template tag needed a trailing slash after it or not. Glad you’ve got it working!


    pcwriter
    Participant

    @pcwriter

    @paulhastings0

    Thanks for the encouragement!

    But before I release this nifty code as a plugin, I gotta figure out how to stop the added links from showing up on member blogs, and in the WP dashboard.

    For ex, on member blogs, the “Community” dropdown is creating links to non-existent stuff like mainsite.com/sub-blog/forums. See a test blog on my site here: ( http://nowrecovery.com/justfunstuff/ ). In the backend, even pages that are set to be excluded from menus (via Exclude Pages plugin) are appearing. Not good.

    Still hoping for clues/help from @hnla who supplied the added code for WP3.0 :-)

    Ah erm… :) Not sure of the issues and would have to set up a test for myself, if it’s simply not displaying those links on sub blogs can you not use a conditional to check whether the main site is being viewed i.e site_id = 1 or whatever the correct method is.

    If and when I get a moment I’ll try and set up your code with the added menu functions I added and have a play around; I sort of wandered off from the add menu function I built to compensate for lack of adminbar dasboard links on single WP installs as I desided to run as Multi site and simply disable create blogs and the main directory link.


    pcwriter
    Participant

    @pcwriter

    @hnla

    …use a conditional to check whether the main site is being viewed…

    That’s exactly what I’m trying to do but can’t seem to get it right :-(

    This works after a bit of fussing :)

    global $blog_id;

    Then wrap the ul in :

    <?php if($blog_id == ‘1’): ?>

    <?php endif; ?>

    That’s a bit rough and ready and not tested greatly. $current_site should have worked and provides more objects to use but didn’t seem to work for me.


    r-a-y
    Keymaster

    @r-a-y

    @hnla – The $current_blog global is what you’re looking for.


    pcwriter
    Participant

    @pcwriter

    @hnla

    I managed to fix the problem with WP page links in the adminbar in the backend by simply hardcoding the ones I don’t want:

    But I still can’t get the darned “Community” dropdown off member blogs. Frustrating, but I’ll keep trying stuff…

    Come to think of it, BP1.3 will use WP pages for BP components. Add the custom menu capability of WP3.0 and this whole code idea will become redundant, no?


    pcwriter
    Participant

    @pcwriter

    Hi @r-a-y Glad you could join in!

    I just tried wrapping the ul in…

    php if($current_blog == ‘1′):

    …but that doesn’t want to work either. Both ideas make all BP and WP links disappear from the adminbar. The only thing left is the “My Account”, “My Blogs”, “Notifications” links.


    pcwriter
    Participant

    @pcwriter

    Time for a nap with my cats. That always helps me think…

Viewing 25 replies - 26 through 50 (of 79 total)
  • The topic ‘Adding menu items to the admin bar’ is closed to new replies.
Skip to toolbar