Adding menu items to the admin bar
@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):
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
Eep! Nevermind, I figured it out. I was missing an ending parenthesis
@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!
@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!)
@justbishop Are you saying it might be possible to write something like
a href= members/bp_displayed_user_username()/profile/change-avatar
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
@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
@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:
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…
@pcwriter I’m looking forward to your plugin.
Ah, yeah, I wasn’t sure if the template tag needed a trailing slash after it or not. Glad you’ve got it working!
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.
…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
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.
@hnla – The $current_blog global is what you’re looking for.
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?
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.
- The topic ‘Adding menu items to the admin bar’ is closed to new replies.