Filter Reference
Filter Reference
Section titled “Filter Reference”BuddyPress Giphy exposes eight apply_filters() hooks you can use to customise its behaviour from a theme, child theme, or a custom plugin.
None of the hooks below require editing the plugin file. Add your code to a plugin or to your theme’s functions.php.
buddypress_giphy_show_button
Section titled “buddypress_giphy_show_button”Controls whether the GIF button is visible to a specific user. Return false to hide it.
Signature
apply_filters( 'buddypress_giphy_show_button', bool $show, int $user_id, array $roles )| Parameter | Type | Description |
|---|---|---|
$show |
bool |
Default: true. Whether to show the button. |
$user_id |
int |
The current logged-in user ID. |
$roles |
array |
The current user’s WordPress roles. |
Example - hide the GIF button for subscribers
add_filter( 'buddypress_giphy_show_button', function( $show, $user_id, $roles ) { if ( in_array( 'subscriber', $roles, true ) ) { return false; } return $show;}, 10, 3 );buddypress_giphy_gif_content_rating
Section titled “buddypress_giphy_gif_content_rating”Modifies the list of GIPHY content-rating options shown in the General settings tab.
Signature
apply_filters( 'buddypress_giphy_gif_content_rating', array $ratings )| Parameter | Type | Description |
|---|---|---|
$ratings |
array |
Associative array of rating_key => label. |
The default array uses these keys: '' (no limit), y, g, pg, pg-13, r. Removing a key removes that option from the dropdown.
Example - limit the site owner to G-rated or stricter options
add_filter( 'buddypress_giphy_gif_content_rating', function( $ratings ) { return array( 'y' => 'Y - Illustrated content only', 'g' => 'G - Suitable for everyone', );} );buddypress_giphy_gif_size
Section titled “buddypress_giphy_gif_size”Modifies the list of GIPHY rendition options shown in the General settings tab (GIPHY provider only).
Signature
apply_filters( 'buddypress_giphy_gif_size', array $sizes )| Parameter | Type | Description |
|---|---|---|
$sizes |
array |
Associative array of rendition_key => label. |
Default keys match the GIPHY Rendition Guide: original, fixed_width, fixed_width_downsampled, fixed_height, fixed_height_downsampled, plus several *_still and *_small variants, and preview.
Example - offer only the two most practical options
add_filter( 'buddypress_giphy_gif_size', function( $sizes ) { return array( 'original' => 'original - Full size', 'fixed_width' => 'fixed_width - 200px wide (good for mobile)', );} );buddypress_giphy_klipy_content_filter
Section titled “buddypress_giphy_klipy_content_filter”Modifies the list of Klipy content-filter options shown in the General settings tab (Klipy provider only).
Signature
apply_filters( 'buddypress_giphy_klipy_content_filter', array $filters )| Parameter | Type | Description |
|---|---|---|
$filters |
array |
Associative array of filter_key => label. |
Default keys: off, low, medium, high. The validation callback (buddypress_giphy_validate_settings) whitelists these four values; any key you add here that is not in the whitelist will fall back to high on save.
Example - hide the “off” option so content filtering cannot be disabled
add_filter( 'buddypress_giphy_klipy_content_filter', function( $filters ) { unset( $filters['off'] ); return $filters;} );buddypress_giphy_klipy_gif_size
Section titled “buddypress_giphy_klipy_gif_size”Modifies the list of Klipy rendition options shown in the General settings tab (Klipy provider only).
Signature
apply_filters( 'buddypress_giphy_klipy_gif_size', array $sizes )| Parameter | Type | Description |
|---|---|---|
$sizes |
array |
Associative array of size_key => label. |
Default keys: hd, md, sm, xs. The validation callback whitelists these four values; any key you add that is not in the whitelist reverts to md on save.
buddypress_giphy_admin_setting_tabs
Section titled “buddypress_giphy_admin_setting_tabs”Modifies the sidebar-tab registry of the plugin’s admin panel. Each tab entry is an array with label, icon (a dashicons class), and group keys.
Signature
apply_filters( 'buddypress_giphy_admin_setting_tabs', array $tabs )| Parameter | Type | Description |
|---|---|---|
$tabs |
array |
Associative array of tab_slug => [ 'label', 'icon', 'group' ]. |
Built-in tabs (added in 1.8.0): overview, general, faq, license.
Example - add a custom tab
add_filter( 'buddypress_giphy_admin_setting_tabs', function( $tabs ) { $tabs['custom'] = array( 'label' => 'Custom', 'icon' => 'dashicons-admin-generic', 'group' => 'settings', ); return $tabs;} );Rendering the tab content requires adding an admin.php?page=bpgp-settings&tab=custom view to the shell’s route map. This hook controls the sidebar only; it does not auto-create the view.
bpgp_license_api_sslverify
Section titled “bpgp_license_api_sslverify”Controls whether sslverify is enabled on the WordPress HTTP API calls the plugin makes to the Wbcom license server.
Signature
apply_filters( 'bpgp_license_api_sslverify', bool $sslverify )| Parameter | Type | Description |
|---|---|---|
$sslverify |
bool |
Default: true. |
This filter exists for development and staging environments where the local server has no trusted SSL certificate. Do not disable SSL verification on production sites.
Example - disable SSL verification on a local dev environment
add_filter( 'bpgp_license_api_sslverify', function( $verify ) { return defined( 'WP_DEBUG' ) && WP_DEBUG ? false : $verify;} );BuddyPress REST API - bp_giphy field on activity
Section titled “BuddyPress REST API - bp_giphy field on activity”This is a consumed hook, not a fired one. The plugin hooks bp_rest_activity_prepare_value at priority 10 to embed GIF data into every BuddyPress REST activity response.
When a member has attached a GIF to an activity, the REST response gains a bp_giphy property:
{ "id": 123, "content": "...", "bp_giphy": { "bp_activity_gif_id": "abc123", "bp_activity_gif": "https://media.giphy.com/media/abc123/giphy.gif" }}When no GIF is attached, bp_giphy is false (or an empty value).
Accessing the field via the REST API
GET /wp-json/buddypress/v1/activityThe bp_giphy field is present in every activity object in the response. Filter by checking whether bp_giphy.bp_activity_gif is non-empty.
Example - reading GIF data from a BuddyPress activity via the REST API (JavaScript)
fetch( '/wp-json/buddypress/v1/activity?per_page=10' ) .then( res => res.json() ) .then( activities => { activities.forEach( activity => { if ( activity.bp_giphy && activity.bp_giphy.bp_activity_gif ) { console.log( 'GIF URL:', activity.bp_giphy.bp_activity_gif ); } } ); } );Activity meta key
The data is stored in BuddyPress activity meta under the key _bp_activity_gif_data as an array with two keys:
| Key | Description |
|---|---|
bp_activity_gif_id |
The GIF identifier from the provider (GIPHY or Klipy). |
bp_activity_gif |
The direct URL of the GIF image. |
You can read this directly with bp_activity_get_meta( $activity_id, '_bp_activity_gif_data', true ) when working server-side.
Hook order and priority reference
Section titled “Hook order and priority reference”| Hook | Type | Priority | Source file |
|---|---|---|---|
buddypress_giphy_show_button |
filter | - (applied when button renders) | buddypress-giphy.php |
buddypress_giphy_gif_content_rating |
filter | - (applied at page render) | includes/admin/views/settings-general.php |
buddypress_giphy_gif_size |
filter | - (applied at page render) | includes/admin/views/settings-general.php |
buddypress_giphy_klipy_content_filter |
filter | - (applied at page render) | includes/admin/views/settings-general.php |
buddypress_giphy_klipy_gif_size |
filter | - (applied at page render) | includes/admin/views/settings-general.php |
buddypress_giphy_admin_setting_tabs |
filter | - (applied at page render) | includes/admin/class-bpgp-admin.php |
bpgp_license_api_sslverify |
filter | - (applied per license API call) | edd-license/edd-plugin-license.php |
bp_rest_activity_prepare_value |
filter | 10 (consumed) | buddypress-giphy.php |
edd_bpgp_sl_api_request_verify_ssl
Section titled “edd_bpgp_sl_api_request_verify_ssl”Controls SSL verification on the EDD software-licensing update request made by the bundled plugin updater.
- Type: filter
- Fires in:
edd-license/EDD_BPGP_Plugin_Updater.php:488 - Parameters:
bool $sslverify(defaulttrue),EDD_BPGP_Plugin_Updater $updater
add_filter( 'edd_bpgp_sl_api_request_verify_ssl', '__return_false' ); // only for local debugging
