Yes you can actually already do this if you add a text box to your theme. You need to pass the parameter ‘search_terms’ into the activity loop.
Something like this? I got it to work this way in a custom page template but not in the activity index. any help…on getting it to work in the activity dir where its bp_ajax_querystring( ‘activity’ ) and some other differences like the filter select.
$searchterm = $_POST['searchterm'];
<form NAME "form1" METHOD "post" ACTION = "<?php bloginfo('url'); ?>/search">
<input TYPE = "TEXT" id="whats-new" Name="searchterm" value="" >
<INPUT TYPE = "Submit" Name = "Submit1" VALUE = "Search Activity">
<?php if ( bp_has_activities('search_terms=' . $searchterm) ) : ?>
<?php if ( bp_has_activities( bp_ajax_querystring( ‘activity’ ) . ‘&search_terms=’ . $searchterm) ) : ?>
Hi, I’m new here. Any updates on this? How do I put this on the default template? I’ve tried using the codes above on the index but it won’t show up. Thanks
I’m running WordPress 2.9.2 and BuddyPress 220.127.116.11 by the way.
@butterscotchproxy i’ll revisit this…I had implemented it and didn’t like it, it was a bit junkie but it worked…maybe I’ll take it further this time around, i’ll get back with where to put it, i forgot and will have to look again.
@r-a-y is there a piece of code somewhere that will allow us to add activity search from the drop down box on BP 1.2+ I was checking out the unified search topic here, but ran into a couple of issues with it…
First you’ll need to add an additional option to the BP dropdown select menu for “activity”.
Check out the “bp_search_form_type_select” filter in bp_search_form_type_select() (located in bp-core-templatetags.php) to add your own.
Then you’ll need to modify the bp_ajax_querystring so it adds the search_terms parameter as Andy has stated above.
Check out the “bp_dtheme_ajax_querystring” filter in the bp-default theme’s /_inc/ajax.php.
Oh…. you guys have too much faith in my ability to comprehend all of this…. I’m a Symphony Conductor! Ok, I’ll give it whirl tonight. Thanks.
No, I did not. But, I didn’t spend too much time on it… I was on to other things…
I moved on to the unified search again.. and now am using that.
@pisanojm Would you mind posting the guide/tutorial that you’re using for unified search? I’d be interested in that.
Some things are here visit the link and read the posts. The other guy updated the tutorial on his site. I think it’s not so easy because also forum search on BP org here when you click on the topic second third and so forth search result pages it gets you error. Pity.
I wasn’t able to get a search-activity working using ajax so i just made a new page template to house the search form and the activity loop that returns the search results and works well. I’ll see if I can post something up on my blog to show how I did it.
Would be great if a ninja could create a plugin or function to get the activity post form to switch between a poster and searcher. So we could do the search right from the activity page just by using a toggle. that would be neat.
Great thread. I’ll bookmark this. I hope someone can offer a solution / tutorial for this too. Thank you.
@thelandman, I’m busy creating one. Will send you the link over the weekend to help test
@antonrsa, thanks mate. I’ve also been busy with an activity stream that is automatically updated with ajax and it neatly drops in with the jcarousel plugin with jquery.
I got it work with the tutorial in buddydev: http://buddydev.com/buddypress/creating-the-sitewide-globalunified-search-page-for-your-buddypress-theme/
I just made one function more:
@juanpons14 Thanks for the code; just started using it on my site. One thing I’ve noticed is that the “Load More” link at the bottom of the results doesn’t work – any thoughts on how to resolve?
This is awesome, all its working perfect, I just need to add the the “usernames” to be searched as well under members… it seems to look at the real names only… any idea how to accomplish this?
Also Im having a little issue with the pagination, when I click on the second page of result, it brings all kinds of different stuff not related with the search…
You must be logged in to reply to this topic.