Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Add you blog search to the search


b_stewart
Member

@b_stewart

@shaisimchi

To integrate the BuddyPress Events plugin (bp-events) to the search is very similar to the code Pedro posted.

on bp-core-tempaltetags.php change this:

function bp_search_form_type_select() {
// Eventually this won't be needed and a page will be built to integrate all search results.
$selection_box = '<select name="search-which" id="search-which" style="width: auto">';

if ( function_exists( 'xprofile_install' ) ) {
$selection_box .= '<option value="members">' . __( 'Members', 'buddypress' ) . '</option>';
}

to this:

function bp_search_form_type_select() {
// Eventually this won't be needed and a page will be built to integrate all search results.
$selection_box = '<select name="search-which" id="search-which" style="width: auto">';
$selection_box .= '<option value="events">' . __( 'Events', 'buddypress' ) . '</option>';

if ( function_exists( 'xprofile_install' ) ) {
$selection_box .= '<option value="members">' . __( 'Members', 'buddypress' ) . '</option>';
}

and on bp-core.php

change this:

if ( !$slug || empty( $slug ) ) {
switch ( $search_which ) {
case 'members': default:
$slug = BP_MEMBERS_SLUG;
$var = '/?s=';
break;

to this:

if ( !$slug || empty( $slug ) ) {
switch ( $search_which ) {
case 'members': default:
$slug = BP_MEMBERS_SLUG;
$var = '/?s=';
break;
case 'events':
$slug = BP_EVENTS_SLUG;
$var = '/?s=';
break;

Hopefully that helps someone out.

Skip to toolbar