Ronald
El Presidente
Just Getting Started
Member Likes (0)
Hiya,
Is there a way to not-display the standard BP menu items Activity and Members (I think?) in the main menu of the social theme for not-logged-in visitors?
Thx and rehards,
Ronald

Responses (68)
Sales & Support Pro (joined March 2010) Likes (0)
Hiya Ronald,
Sure! I believe you would just need to remove lines 21-56 of navigation.php.
It is wise to do this as part of a child theme though. If you're not familiarly with child themes or theme development you should check out http://codex.wordpress.org/Child_Themes
Phil
Lifetime Member (joined August 2011) Likes (0)
Does that theme not use menus?
Member (joined March 2011) Likes (0)
Nope Phil, the items stayed in place, no matter if I was logged in or out...
I deleted a bit more, but that did not help either, so tried what happened when I removed the whole file: that worked!
But now (off course) the items are also not visible when one is logged in and is permitted to see them...
With the membership module this menu-items are not visible, so I can't uncheck them for the stranger-level.
You have another idea?
@bigonroad
Yes, it uses menus, but the BP items are automatically added and not visible in the menu admin section.
Sales & Support Pro (joined March 2010) Likes (0)
Ah sorry, I completely missed the whole logged in bit!
Instead of deleting those lines add this before line 19:
<?php if (is_user_logged_in()): ?>and this after line 60 (last line):
<?php endif; ?>That *should* hide the menu for non-logged in users.
Phil
Lifetime Member (joined August 2011) Likes (0)
That's what I meant: it doesn't use the inbuilt menu admin.
It's what @Phil said then, gotta take out some lines of code!
Lifetime Member (joined August 2011) Likes (0)
Just clocked the logged in bit too.
Member (joined March 2011) Likes (0)
Sorry Phil, doesn't work.
Checked: navigation.php is in the bp-social-child dir, with style.css and footer.php.
Deactivated my caching plugin, didn't help.
Sales & Support Pro (joined March 2010) Likes (0)
Where is bp-social-child?
Have you moved it to wp-content/themes?
Phil
Member (joined March 2011) Likes (0)
Offcourse Phil, I read the child-theming instructions. My css and footer adjustments work fine.
Sales & Support Pro (joined March 2010) Likes (0)
Okay, good - sorry, have to ask!
Can I get a link to the site to check that the styles are included correctly please?
Phil
Member (joined March 2011) Likes (0)
Offcourse you have to ask, I understand ;-)
http://www.latonatrainingen.nl
As you can see: when bp is activated, also the home link is doubled...
Sales & Support Pro (joined March 2010) Likes (0)
Have you created a menu in Appearance > Menus? Can you show me a screenshot of that?
Thanks,
Phil
Member (joined March 2011) Likes (0)
Yep.
Here it is.
Lifetime Member (joined August 2011) Likes (0)
What settings do you have under Settings > General?
Member (joined March 2011) Likes (0)
Here is a screenshot, bigonroad!
Thx!
Lifetime Member (joined August 2011) Likes (0)
(Totally thrown by it all being in Dutch hehe)
Lifetime Member (joined August 2011) Likes (0)
Dammit, I meant Permalinks and Reading. Sorry, I'm tired!
Member (joined March 2011) Likes (0)
Ah!
I wondered already....
Will do so first thing in the morning.
Good night!
Lifetime Member (joined August 2011) Likes (0)
See ya
Member (joined March 2011) Likes (0)
Morning!
OK, let's see:
Permalinks:
custom style: /blog/%year%/%monthnum%/%day%/%postname%/
Reading:
Homepage is a static page, called Welcome (the one that's visible now).
Blogpage is not set.
Is that enough or do you need screenshots?
Thx for helping and kind regards,
Ronald
Lifetime Member (joined August 2011) Likes (0)
Okay, trying to recreate this in my test site
Lifetime Member (joined August 2011) Likes (0)
Sorry mate, I don't have the bp-social theme.
Not sure if the forum bods are okay with me having it for free to test this?
Feel free to email it to me, and I'll test it for ya - bigonroad [at] gmail.com
Lifetime Member (joined August 2011) Likes (0)
Ok, just loaded it on the test site, will have a hunt.
Will delete it after we've got this sorted!
Lifetime Member (joined August 2011) Likes (0)
So, with navigation.php edited, my site now takes off those items for non logged in people.
Lifetime Member (joined August 2011) Likes (0)
See a test page here - http://allaboutchris.org/test/
Member (joined March 2011) Likes (0)
Just to be sure: you mean that the adjustments as Phil suggested on the navigation.php work in your testsite, so that non-logged in people do not see the bp-menu-items?
Member (joined March 2011) Likes (0)
Copied and uploaded your file, but result stays the same with me...
Sales & Support Pro (joined March 2010) Likes (0)
Ronald,
You have an item for "Home" in your menu in Appearance > Menus. You don't need that as the theme adds the home item for you.
Remove that Home item from your menu and you'll have only one.
Phil
Member (joined March 2011) Likes (0)
Did it.
thought to leave it there for you to check.
A small bit better...
Lifetime Member (joined August 2011) Likes (0)
Weird - it's definitely working in mine, you can see.
You sure you don't have another child theme overriding it or something?
Member (joined March 2011) Likes (0)
Yes, I'm sure, but offcourse am not aware of any blind spot...
I can give you ftp + admin inlog if you want...
Lifetime Member (joined August 2011) Likes (0)
Sounds good, I have some time later, so I'll take a look.
Thanks for the rep points!
Member (joined March 2011) Likes (0)
Sorry, saw this thread was marked as resolved, but it isn't.
I did a complete new download and installed a clean child-theme. Adjusted navigation.php according instructions above and uploaded it to child-theme root, next to style.css and screenshot.png.
It seems to work with Chris, but still not on my site.
De-activated all plugins (except bp), but that did also make no difference...
Could it be php5.3?
What am I missing?
Sorry and thx,
Ronald
Lifetime Member (joined August 2011) Likes (0)
Having another look for ya!
Lifetime Member (joined August 2011) Likes (0)
Ok, so the child theme wasn't loading navigation.php
No idea why. For now I have edited the main theme as well, but I'll carry on fiddling!
Member (joined March 2011) Likes (0)
OK, that's coolll.
Shall we return the non-loading of the child's navigation.php tot the devs here?
Lifetime Member (joined August 2011) Likes (0)
Yep.
Guys, for some reason, the child navigation.php doesn't load. Any ideas why?
Chris
Member (joined March 2011) Likes (0)
OK, thx very much for helping out, Chris.
Perhaps you can check on the disappearing submenu-items in this thread again?
http://premium.wpmudev.org/forums/topic/submenu-not-ok-in-ie
Regards!
Member (joined March 2011) Likes (0)
A small bump for devs:
Please note that navigation.php does not load from child theme in bp-social theme.
Can you confrim and close topic?
Cheers!
Member (joined April 2009) Likes (0)
Hiya Ronald,
In the parent theme, go to bp-social/lib/templates/wp-template/top-bar.php.
Change line 46 from:
<?php include( TEMPLATEPATH . '/navigation.php'); ?>to the following:
<?php locate_template( array('navigation.php', true); ?>Revert the parent theme's navigation.php file to the original and see if the child theme uses it's own navigation.php file.
It's just a little legacy code in the theme. If you can confirm I'll ask for it to get incorporated into an updated version of the theme (that way when the theme is updated you won't lose the above change).
Thanks!
Lifetime Member (joined August 2011) Likes (0)
Nice, I knew that was an issue!
Member (joined March 2011) Likes (0)
I'm sorry James, I followed the instructions, but it results in a completely blank page...
Lifetime Member (joined August 2011) Likes (0)
Is this the same site as you sent me FTP for? I'll go and have a look if so.
What page are you having the blank page on?
Member (joined March 2011) Likes (0)
Yes, it is.
The whole site goes blank.
Let me backup first, then I'll send you new ftp and admin names and pwd's.
Lifetime Member (joined August 2011) Likes (0)
Thanks.
Lifetime Member (joined August 2011) Likes (0)
I can confirm that the site goes blank on setting that.
Spent ages reading up on
locate_template();- then realised it was just missing a paranthesis -<?php locate_template( array('navigation.php', true)); ?>and now it works heheMember (joined March 2011) Likes (0)
Sorry mate,
but when I restore the original navigation.php (which is the intention, otherwise your adjustments are not necessary), it still doesn't load the bp-social-child navigation.php.
Geeky Developer (joined June 2009) Likes (0)
try replace the navigation.php in child theme or parent (if navigation.php in child theme did not exist) with this one.
Lifetime Member (joined August 2011) Likes (0)
@Richie that's not really the issue - we have navigation.php working, the issue is that the social theme is not recognising the child navigation.php
The original issue was that the code said
<?php include( TEMPLATEPATH . '/navigation.php'); ?>which loaded the parent navigation.php with no option for child themes.But now we have used
<?php locate_template( array('navigation.php', true)); ?>- specifically designed to locate a template from the folder that the child stylesheet is based from, I don't see why it doesn't work!Chris
Member (joined March 2011) Likes (0)
Chris is correct Richie.
The problem is the recognition of the navigation.php in the child theme.
@Chris: situation is restored as was before you tried, earlier this morning.
Thx guys!
Lifetime Member (joined August 2011) Likes (0)
@Ronald - how about
<?php include( STYLESHEETPATH . '/navigation.php'); ?>?Lifetime Member (joined June 2009) Likes (0)
This is the correct way to get a template in a child theme
<?php get_template_part( 'navigation' ); // Loads the navigation.php template. ?>get_template_part is just another way to include another file. But it’s more powerful than a php include statement, because of its flexibility.
It’s amazingly useful, especially for anyone trying to build a child theme.
As I understand it, you are using a child theme? So the above get_template_part will look for the navigation.php in the child theme, if it doesn't find it, it will use the one in the parent theme.
This should sort this issue out ;)
@Ronald,
I know you've tried loads of ways to try and include the navigation.php in your child theme. Could you try my recommendation
<?php get_template_part( 'navigation' ); // Loads the navigation.php template. ?>This will look for the navigation.php file in your child theme if you have a custom one (which I understand you do). Or, if it can't find it, it will load the one from the parent theme. But this get_template_part handles child themes templates better than the rest - In my experience.
Lifetime Member (joined August 2011) Likes (0)
That does look a better way to do it. :)
One question though, why did locate_template() not do it? To me it seemed that should work in a similar manner - http://www.themightymo.com/2010/01/14/use-locate_template-instead-of-templatepath-to-include-files-in-a-buddypress-child-theme/
Lifetime Member (joined June 2009) Likes (0)
@bigonroad,
Firstly, still waiting to see if my recommendation works ;)
Secondly, locate_template is extremely powerful and get_template_part actually uses it if I remember correctly. But the reason it doesn't work is it isn't pointed at the right place - it can't see/find the file. This is where the issue lies. Something has messed up its compass. get_template_part has its compass set either here or here. get_template_part is made for custom templates rather than standard WordPress templates.
Here is the granddaddy of template loading tutorials ;)
http://justintadlock.com/archives/2010/11/17/how-to-load-files-within-wordpress-themes
Sidenote: BP-SOCIAL is a monster theme - it really is a big boy - wow! I'm more of a minimalist when it comes to code. But guess bp-social is meant to be everything to everyone ;)
Member (joined March 2011) Likes (0)
I'm at work now and can't ftp.
Will do tomorrow morning and let you know!
Thx Jonathan and Chris!
Member (joined March 2011) Likes (0)
Changed line 46 of top-bar.php and restored navigation.php from the parent theme.
OK, works Jonathan!!!!
BUT.....
Now my link to the homepage "Home" is gone when logged out.
I added it via the menu, but now I have TWO "Home"s when logged in...
Menu order is then:
home - activity - members - home - rest of my menu...
What to do about that?
Thx and good night,
Ronald
Lifetime Member (joined June 2009) Likes (0)
@Ronald,
Whew! Glad that worked.
2nd question - It's early forgive me - which navigation.php are you now using... there is the one that is placed up above
Notice the is_user_logged_in() is in front of the home so non-logged in users can't see it. And notice that the activity is hardcoded in there still so it is going to display to logged in users as is the members link.
have you tried Richie_Ks's version (he is the theme developer)
http://premium.wpmudev.org/forums/topic/bp-menu-items#post-122398
Notice he put the is_user_logged_in() after the home. So home will show whether logged in or not.
The menu showing incorrect items is because those items are still present in the navigation.php code
i.e home and activity and members.
Perhaps to get everyone on the same page again. Can you share your latest navigation.php page ;)
Lifetime Member (joined June 2009) Likes (0)
And what pages do you want to show / not show ;) for those (me) who is trying to catch up - lol
e.g Home | Your Menu ?
Member (joined March 2011) Likes (0)
Good morning Jonathan!
First of all: I'm not a coder, so I'l try to answer your questions as good as possible, trying to create as little confusion as possible...
OK, here we go:
- I use the unadjusted, as delivered with theme, navigation.php in the parent theme, and in the child theme the one whose code you put first.
- I did try Richie's version, but probably in a wrong combination with the top-bar.php, because it didn't give a wanted result.
- I tried again and now it's very much OK!
- Menu as is now for http://www.latonatrainiingen.nl is exactly what I want
So the problem is really solved now.
Your suggestion for top-bar.php and Richie's navigation.php should be in the next version of the theme.
Thx and have a nice sunday!!
Lifetime Member (joined June 2009) Likes (0)
Woot! That is great news - lol.
Have a fantastic sunday too :)
Member (joined March 2011) Likes (0)
YEP!!
@Phil or @MasonJames or @Richie_KS
can you add this improvement to the next version of theme and close topic?
Then we're sure the efforts of you guys, Chris and Jonathan were worth the trouble.
Thx for great support and kind regards,
Ronald
Lifetime Member (joined August 2011) Likes (0)
Think that would make sense.
I had noticed exactly the same problem even after moving the
<?php if (is_user_logged_in() ) { ?>though!Lifetime Member (joined August 2011) Likes (0)
Ignore my other post, forgot to reload page to see if there are new posts.
Jolly glad it worked mate, nice site!
Member (joined March 2011) Likes (0)
Thx Chris!
Have a nice sunday and kind regards,
Ronald
Lifetime Member (joined August 2011) Likes (0)
Marked as resolved. *finally*
Member (joined March 2011) Likes (0)
How we know dev's pick it up for next version of theme then?
Lifetime Member (joined June 2009) Likes (0)
Yeah, leave it unresolved - that way it has semi decent chance of being picked up ;)
Helps to roadmap changes to be made:
WPMU DEV STAFF / DEVELOPERS: Core Changes to be made to bp-social.
Change 1: This navigation.php file
http://premium.wpmudev.org/forums/topic/bp-menu-items#post-122398
Change 2:
In the parent theme, go to bp-social/lib/templates/wp-template/top-bar.php.
Change line 46 from:
<?php include( TEMPLATEPATH . '/navigation.php'); ?>to this
<?php get_template_part( 'navigation' ); // Loads the navigation.php template. ?>Hope that covers it ;)
Geeky Developer (joined June 2009) Likes (0)
hi guys
closing and mark this as resolved.
in new BuddyPress 1.5 ( coming soon )...all internal buddypress component will be convert to
wordpress pages so there's no need for the navigation.php.
@jonathan
thx for looking into this issue:)
cheers
Thanks for viewing this post but this topic has been closed to new replies.
Become a member