BuddyPress

The built-in BuddyPress integration routes member-directory searches through a CelerSearch Users index. Members can be found with typo-tolerant search instead of BuddyPress's native SQL matching, and public Extended Profile fields can participate in member discovery.

The integration activates automatically when BuddyPress is active. It does not require a separate add-on.

What the integration adds

  • A Users index type for WordPress accounts and membership profiles
  • A BuddyPress Members Directory search-area type
  • Public, non-empty BuddyPress Extended Profile (xprofile) data in user documents
  • Automatic user re-sync after profile updates and account activation
  • Native BuddyPress search as a safe fallback if the search service is unavailable

BuddyPress must be active

The BuddyPress search-area option is registered conditionally. If it is missing from the type list, confirm that BuddyPress is active, then reload CelerSearch → Settings → Search Areas.

1. Create a Users index

Go to CelerSearch → Indices → Add Index, select Users, and choose the service that should store the index.

The index configuration includes:

  • Roles — choose which WordPress roles belong in the directory. Leave the selection empty to include every role.
  • Index email addresses (admin search only) — optional. This allows email matching in wp-admin user search; email is never returned by the public member-directory result formatter.

Create the index, then run its first Rebuild to index existing members.

2. Member fields that are searched

The default Users index searches display name, username slug (user_nicename), first and last name, role labels, and the profile description.

When BuddyPress Extended Profiles are active, CelerSearch adds each member's non-empty public profile fields under the xprofile document attribute and makes them searchable automatically — there is no manual setup. After enabling BuddyPress (or adding new profile data), run the Users index Rebuild so the new fields are included.

Examples

With public fields such as Company, Skills, or Location, a member directory search can match values such as “photographer”, “Skopje”, or an organization name.

3. Add the BuddyPress search area

  1. Open CelerSearch → Settings and enable the master Enable CelerSearch switch.
  2. Select the Search Areas tab and click Add Search Area.
  3. Choose BuddyPress Members Directory as the type.
  4. Select the Users index created above.
  5. Enable the area and save the settings.

The normal BuddyPress members-directory search form now resolves matching member IDs through CelerSearch. Directory pagination is passed to the search engine, so each BuddyPress page requests only the corresponding result window.

Profile privacy

CelerSearch indexes only Extended Profile fields whose BuddyPress visibility level is public. Fields restricted to logged-in members, friends, or administrators do not enter the search index by default. Empty values are skipped, and multi-value fields are normalized to a comma-separated string.

You can change the allowed visibility levels with a filter, but doing so can place restricted member data on the search service:

functions.php
PHP
add_filter(
    'celersearch_bp_indexable_visibility_levels',
    function (array $levels, $field, int $user_id): array {
        // Keep the safe default unless your privacy policy explicitly allows more.
        return ['public'];
    },
    10,
    3
);

Review visibility before widening it

Treat this filter as a data-export decision. A field allowed here is copied into the member's search document, even if BuddyPress normally hides it from a visitor.

How member syncing works

Existing members are loaded by the initial rebuild. After that, CelerSearch keeps the Users index current when:

  • a user is registered or their WordPress profile changes;
  • a role is added, removed, or replaced;
  • watched user metadata such as name, nickname, or description changes;
  • a BuddyPress Extended Profile is updated;
  • a BuddyPress account is activated; or
  • a user is deleted.

If background queueing is enabled, these updates are scheduled through the normal CelerSearch sync queue. Otherwise they are processed immediately.

Failure behavior

CelerSearch intercepts only BuddyPress user queries that contain a search term and have the enabled BuddyPress search area. Empty directory views continue through BuddyPress normally. It also respects queries that already provide an explicit member-ID list.

If the Users index cannot be resolved or the search request throws an error, the integration leaves the BuddyPress query untouched. BuddyPress then performs its native search instead of returning a broken directory.

Developer filters

The integration exposes focused filters for advanced installations:

FilterPurpose
celersearch_bp_members_search_paramsChange the search parameters, including limit and offset
celersearch_should_intercept_bp_members_queryDisable interception for a particular request
celersearch_select_bp_members_indexProvide a Users index configuration programmatically
celersearch_bp_indexable_visibility_levelsControl which xProfile visibility levels may be indexed