Skip to content

AJAX Actions

BuddyPress Profile Pro registers exactly seven AJAX actions. All seven are admin-only — registered on wp_ajax_* with no wp_ajax_nopriv_* variant. No public-facing AJAX handler exists.

Every request must:

  1. Include a nonce in the correct POST field (see each action for the field name).
  2. Come from a user with the manage_options capability.

Requests that fail the nonce check call check_ajax_referer() (which dies on failure) or return a WP_Error via wp_send_json_error(). Requests that pass the nonce but fail the capability check receive wp_die( -1, 403 ).

Base URL: admin_url( 'admin-ajax.php' )

Nonce generation (all actions except bprm_search_field_row use the same nonce action):

$nonce = wp_create_nonce( 'bprm_admin_ajax_security' );

Creates a new field group, persists it to wbbpp_profile_groups_settings, and returns its rendered HTML panel for immediate insertion into the admin Groups tab UI.

Handler: Buddypress_Profile_Pro_Admin::wbbpp_save_new_group()

POST to admin-ajax.php

Field Value
action wbbpp_save_new_group
ajax_nonce wp_create_nonce( 'bprm_admin_ajax_security' )
data URL-encoded (serialized) form string — see fields below

Fields within the data string:

Key Description
bprm_gp_title Group display name
bprm_gp_desc Group description
bprm_gp_display_area bprm_content (main column) or bprm_sidebar (sidebar column)
bprm_gp_profile_display yes to show this group on the profile view
bprm_gp_resume_display yes to show this group on the resume view
bprm_gp_repeater yes to enable repeater rows for this group
bprm_gp_avail user_roles or mem_type to restrict visibility; omit to show all users
wbbpp_grp_avail_user_roles[] Selected role slugs (only when bprm_gp_avail=user_roles)
wbbpp_grp_avail_mem_type[] Selected member type slugs (only when bprm_gp_avail=mem_type)

The group key is generated server-side as time() at the moment of the request.

Echoes the complete HTML markup for the new group panel (the sortable tab + settings form), then calls die(). The admin JS appends this HTML directly to the groups list without a page reload.


Creates a new field within an existing group, persists it to wbbpp_profile_fields_settings, and returns the rendered field row HTML for immediate insertion into the admin Fields tab UI.

Handler: Buddypress_Profile_Pro_Admin::wbbpp_save_new_field()

POST to admin-ajax.php

Field Value
action wbbpp_save_new_field
ajax_nonce nonce value
data URL-encoded form string — see fields below

Key fields within the data string:

Key Description
bprm_nf_group The group key this field belongs to
bprm_nf_type Field type slug (e.g. textbox, dropdown, image)
bprm_nf_title Label shown next to the field on the profile
bprm_nf_description Help text displayed below the input
bprm_nf_required Present if the field is required on the registration and edit forms
bprm_nf_repeater Present if the field participates in a repeater group’s rows
bprm_nf_show_on Where to show the input — profile edit form, registration page, or both
bprm_nf_display Present if the field value should appear on the public profile view
bprm_nf_field_type_option[] Predefined option values for choice-based types: dropdown, checkbox, radio_button, selectize, text_dropdown

The field key is generated server-side as time().

Echoes the HTML <li> element for the new field row (including its settings form inline), then calls die().


Returns the “Field Options” input area HTML when an admin selects a choice-based field type while filling in the Add New Field form. Used to show or hide the options list dynamically as the type selector changes.

Handler: Buddypress_Profile_Pro_Admin::wbbpp_new_field_type_html()

POST to admin-ajax.php

Field Value
action wbbpp_new_field_type_html
ajax_nonce nonce value
ftype The field type key being selected

If ftype is non-empty: echoes a <div class="bprm-groups-key-field-item"> block containing a text input with add/remove option controls, then calls die().

If ftype is empty or missing: echoes an empty string and calls die().

The response is only meaningful for choice-based types (dropdown, checkbox, radio_button, selectize, text_dropdown). For non-choice types, the admin UI does not trigger this call.


Returns the “Field Options” HTML for a field that already exists, when an admin changes its type on the Fields settings tab. Functionally similar to wbbpp_new_field_type_html but targets the settings form for an existing field rather than the “Add New” form.

Handler: Buddypress_Profile_Pro_Admin::wbbpp_setting_form_fld_typ_html()

POST to admin-ajax.php

Field Value
action wbbpp_setting_form_fld_typ_html
ajax_nonce nonce value
ftype The new field type key
fname The name attribute value for the options input (the existing field’s settings form field name)

Both ftype and fname must be non-empty. If either is missing, the handler echoes an empty string and calls die().

Echoes a <th scope="row"> + <td> HTML block containing the field-options text input(s) with add/remove controls, then calls die().


Returns a new blank search-field row for the Profile Search settings tab. Called when an admin clicks Add Search Field to append a new configurable row.

Handler: Buddypress_Profile_Pro_Admin::bprm_get_search_field()

POST to admin-ajax.php

Field Value
action bprm_get_search_field
ajax_nonce nonce value

No additional parameters are required.

Echoes a <div class="search_field"> block containing:

  • A sort handle
  • A field selector dropdown listing all configured extended profile fields plus built-in BuddyPress fields (first name, last name, nickname, user email, etc.)
  • A Delete link

Then calls wp_die().

The admin JS inserts this HTML into the search fields list. The operator/value inputs for the selected field are populated by a subsequent bprm_search_field_row call.


Returns the operator selector and value input controls for a specific search field, called when an admin picks a field from the field dropdown on the Profile Search settings tab. The controls rendered depend on the chosen field’s type.

Handler: Buddypress_Profile_Pro_Admin::bprm_search_field_row()

Note: This action uses a different nonce POST field name from the other six actions.

POST to admin-ajax.php

Field Value
action bprm_search_field_row
profile_pro_nonce wp_create_nonce( 'bprm_admin_ajax_security' )
field The selected field’s key value
field_name The human-readable field label (used to pre-fill the Field Label input)

The nonce is verified with wp_verify_nonce( $nonce, 'bprm_admin_ajax_security' ). A failure returns a JSON error via wp_send_json_error() — it does not call check_ajax_referer().

If field is non-empty: echoes the HTML spans for the full row — field selector (pre-selected to the chosen field), Field Label text input, Field Description text input, Search Mode <select>, and Delete link — then calls wp_die().

If field is empty: echoes nothing and calls wp_die().

The Search Mode options (e.g., contains, is, range) are returned by wbbpp_get_bprm_search_filters() and vary by field type.


Tests a Google Places API key by making a live Nearby Search request to the Google Places API. Stores the result so the admin UI can reflect whether the key is active.

Handler: Buddypress_Profile_Pro_Admin::wp_ajax_wbbpp_verify_apikey()

POST to admin-ajax.php

Field Value
action wbbpp_verify_apikey
ajax_nonce nonce value
apikey The Google API key string to test
latitude Latitude for the test Places query
longitude Longitude for the test Places query

JSON via wp_send_json_success():

{ "data": { "message": "verified" } }

or

{ "data": { "message": "not-verified" } }

Verification logic:

  • A Google HTTP 200 response that is not REQUEST_DENIEDverified.
  • A non-200 HTTP response → not-verified.
  • A 200 response with status: REQUEST_DENIED in the JSON body → not-verified.

Side effects on every call:

  • Writes verified or not-verified to the wbbpp_googlemapapi_status WordPress option.
  • Writes yes or no to the wbbpp_apikey_verified BuddyPress option (via bp_update_option()).

These two options control whether the Google Place Autocomplete field type is available to members on the frontend.