drdave
Expert
Just Getting Started
Member Likes (0)
I do not want visitors searching my site if they are not logged in see image below for both search boxes I want to remove.
Also if you can provide detail how to get this done.
Another thing is I want to of course place this file somewhere outside of buddypress. So help on where to place the file (whatever or wherever that file is), will also be appreciated.
So to avoid any delays of course if I can get help on this...
1. In the images below those search boxes should not be available to logged out users.
2. Detail instructions on which file to edit, code to use and where to place the file once I am done editing it.
I did what I thought was correct procedures but it did not work out for me.
bp-daily 3.9.6
buddypress 1.2.7

Responses (7)
Keeper of the Dark Chocolate (joined July 2007) Likes (0)
Best bet would be a chack against is_user_logged_in(). Wrap the content within the check. If they're not, pass them on with en else.
http://codex.wordpress.org/Function_Reference/is_user_logged_in
Instead of the 'welcome registered user' bit, put the search form or file include in there.
Does that make sense?
I don;t have bp-daily in front of me here so not sure which file to edit. I;m reinstalling woindows today so my drive got whipped. I can check once I get done but it;s going to be tomorrow. Hour 7 so far and I;ve just finished Vista.
Member (joined May 2010) Likes (0)
no
No problem I will wait until you repost or if someone else can get to it.
Keeper of the Dark Chocolate (joined July 2007) Likes (0)
As in you;re not familiar with the check or you need a better example of how to use it?
And the reinstall didn;t take. I still have my malware problem. *grumble*
Member (joined May 2010) Likes (0)
drmike
I doubt a reinstall will fix a malware problem. Time to reformat/clean install.
Keeper of the Dark Chocolate (joined July 2007) Likes (0)
That's what I spent the day doing. Lots of fun. :(
Open up the theme's header.php and look for this bit:
Try this:
Probably have to do it inside of the search bar div to leave the space there.
Does that help?
Member (joined May 2010) Likes (0)
drmike seem to me like you're making perfect sense here.
I was editing the wrong header.php @ first but now that I'm trying this one I still don't see why your suggestions won't work as this is the header file for my theme. I tried it inside and outside the /div tags. Still negative.
Also this code appears to be for the wordpress search box and not buddypress which is really the most important one I'm trying to remove.
It has some entry like search-terms and it's in the buddypress theme folder. It's also called header.php though. Wonder if placing it in the plugins folder and applying your code will do the trick? It don't work in child folder.
Member (joined May 2010) Likes (0)
I mean place that code in bp-custom.php in plugins folder but that did not work either.
<div id="search-bar">
<?php ( is_user_logged_in() ) { ?>
<?php locate_template( array( '/library/components/searchform.php' ), true ); ?>
<?php if($bp_existed == 'true') : ?>
<?php //do_action( 'bp_search_login_bar' ) ?>
<?php endif; ?>
<?php } ?>
</div><!-- #search-bar -->
Become a member