Functions

__()

__($text, $domain = 'default'
package BuddyPress

Parameters

$text

$domain

__n()

__n($singular, $plural, $count, $domain = 'default'
package BuddyPress

Parameters

$singular

$plural

$count

$domain

Gets the list of activity types name supporting the requested feature.

_bp_activity_get_types_by_support(string $feature = 'generated-content') : array

This function is still a WIP, please don't use it into your plugins or themes.

package BuddyPress
since 10.0.0
access private
todo `bp_activity_set_action()` should be improved to include a supports argument or best we should create a `bp_register_activity_type()` function to mimic the way WordPress registers post types. For now we'll use a non extendable workaround.

Parameters

$feature

string

The feature activity types should support.

Returns

arrayThe list of activity types name supporting the requested feature.

Injects specific BuddyPress CSS classes into a widget sidebar.

_bp_core_inject_bp_widget_css_class(array $params) : array

Helps to standardize styling of BuddyPress widgets within a theme that does not use dynamic CSS classes in their widget sidebar's 'before_widget' call.

package BuddyPress
since 2.4.0
deprecated 12.0.0
access private
global array $wp_registered_widgets Current registered widgets.

Parameters

$params

array

Current sidebar params.

Returns

array

Temporary implementation of 'bp_moderate' cap.

_bp_enforce_bp_moderate_cap_for_admins(array $caps = array(), string $cap = '', integer $user_id = 0, array $args = array()) : array

In BuddyPress 1.6, the 'bp_moderate' cap was introduced. In order to enforce that bp_current_user_can( 'bp_moderate' ) always returns true for Administrators, we must manually add the 'bp_moderate' cap to the list of user caps for Admins.

Note that this level of enforcement is only necessary in the case of non-Multisite. This is because WordPress automatically assigns every capability - and thus 'bp_moderate' - to Super Admins on a Multisite installation. See \WP_User::has_cap().

This implementation of 'bp_moderate' is temporary, until BuddyPress properly matches caps to roles and stores them in the database.

Plugin authors: Please do not use this function; thank you. :)

package BuddyPress
since 1.6.0
deprecated 7.0.0
access private
see

Parameters

$caps

array

The caps that WP associates with the given role.

$cap

string

The caps being tested for in WP_User::has_cap().

$user_id

integer

ID of the user being checked against.

$args

array

Miscellaneous arguments passed to the user_has_cap filter.

Returns

array$allcaps The user's cap list, with 'bp_moderate' appended, if relevant.

Filters the WP theme support API so that it can be used to check whether the current theme has global BuddyPress and/or BP Component specific support.

_bp_filter_current_theme_supports(boolean $supports = false, array $args = array(), mixed $feature = null) : boolean

Please do not use in your plugins or themes.

package BuddyPress
since 14.0.0
access private

Parameters

$supports

boolean

Whether the active theme supports the given feature. Default false.

$args

array

Array of arguments for the feature.

$feature

mixed

The theme feature.

Returns

booleanTrue if the feature is supported. False otherwise.

Backward compatibility for 'last_activity' usermeta fetching.

_bp_get_user_meta_last_activity_warning(null $retval, integer $object_id, string $meta_key, boolean $single) : string | null

In BuddyPress 2.0, user last_activity data was moved out of usermeta. For backward compatibility, we continue to mirror the data there. This function serves two purposes: it warns plugin authors of the change, and it returns the data from the proper location.

package BuddyPress
since 2.0.0
since 2.9.3 Added the `$single` parameter.
access private For internal use only.

Parameters

$retval

null

Null retval value.

$object_id

integer

ID of the user.

$meta_key

string

Meta key being fetched.

$single

boolean

Whether a single key is being fetched (vs an array).

Returns

stringnull

Remove WP's canonical redirect when we are trying to load BP-specific content.

_bp_maybe_remove_redirect_canonical() 

Avoids issues with WordPress thinking that a BuddyPress URL might actually be a blog post or page.

This function should be considered temporary, and may be removed without notice in future versions of BuddyPress.

package BuddyPress
since 1.6.0

Remove WP's rel=canonical HTML tag if we are trying to load BP-specific content.

_bp_maybe_remove_rel_canonical() 

This function should be considered temporary, and may be removed without notice in future versions of BuddyPress.

package BuddyPress
since 1.6.0

_bp_mock_mailer()

_bp_mock_mailer($class) 
package BuddyPress

Parameters

$class

_bp_mock_mailer()

_bp_mock_mailer($class) 
package BuddyPress

Parameters

$class

Sort BuddyPress nav menu items by their position property.

_bp_nav_menu_sort(array $a, array $b) : integer

This is an internal convenience function and it will probably be removed in a later release. Do not use.

package BuddyPress
access private
since 1.7.0

Parameters

$a

array

First item.

$b

array

Second item.

Returns

integerReturns an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.

Rehook maybe_redirect_404() to run later than the default.

_bp_rehook_maybe_redirect_404() 

WordPress's maybe_redirect_404() allows admins on a multisite installation to define 'NOBLOGREDIRECT', a URL to which 404 requests will be redirected. maybe_redirect_404() is hooked to template_redirect at priority 10, which creates a race condition with bp_template_redirect(), our piggyback hook. Due to a legacy bug in BuddyPress, internal BP content (such as members and groups) is marked 404 in $wp_query until bp_core_load_template(), when BP manually overrides the automatic 404. However, the race condition with maybe_redirect_404() means that this manual un-404-ing doesn't happen in time, with the results that maybe_redirect_404() thinks that the page is a legitimate 404, and redirects incorrectly to NOBLOGREDIRECT.

By switching maybe_redirect_404() to catch at a higher priority, we avoid the race condition. If bp_core_load_template() runs, it dies before reaching maybe_redirect_404(). If bp_core_load_template() does not run, it means that the 404 is legitimate, and maybe_redirect_404() can proceed as expected.

This function will be removed in a later version of BuddyPress. Plugins (and plugin authors!) should ignore it.

package BuddyPress
since 1.6.1
link https://buddypress.trac.wordpress.org/ticket/4329
link https://buddypress.trac.wordpress.org/ticket/4415

Adds the `bp_moderate` cap to Roles having the `manage_options` cap when BuddyPress is not active on the network.

_bp_roles_init(\WP_Roles $wp_roles) 
package BuddyPress
since 7.0.0
access private

Parameters

$wp_roles

\WP_Roles

The WordPress roles object.

Strip the span count of a menu item or of a title part.

_bp_strip_spans_from_title(string $title_part = '') : string
package BuddyPress
since 2.2.2

Parameters

$title_part

string

Title part to clean up.

Returns

string

Backward compatibility for 'last_activity' usermeta setting.

_bp_update_user_meta_last_activity_warning(integer $meta_id, integer $object_id, string $meta_key, string $meta_value) 

In BuddyPress 2.0, user last_activity data was moved out of usermeta. For backward compatibility, we continue to mirror the data there. This function serves two purposes: it warns plugin authors of the change, and it updates the data in the proper location.

package BuddyPress
since 2.0.0
access private For internal use only.

Parameters

$meta_id

integer

ID of the just-set usermeta row.

$object_id

integer

ID of the user.

$meta_key

string

Meta key being fetched.

$meta_value

string

Active time.

Strip close comment and close php tags from file headers used by WP See http://core.trac.wordpress.org/ticket/8497

_cleanup_header_comment($str) 
package BuddyPress
since 2.8

Parameters

$str

Perform a deep string replace operation to ensure the values in $search are no longer present

_deep_replace(string|array $search, string $subject) : string

Repeats the replacement operation until it no longer replaces anything so as to remove "nested" values e.g. $subject = '%0%0%0DDD', $search ='%0D', $result ='' rather than the '%0%0DD' that str_replace would return

package BuddyPress
since 2.8.1
access private

Parameters

$search

stringarray

$subject

string

Returns

stringThe processed string

_e()

_e($text, $domain = 'default'
package BuddyPress

Parameters

$text

$domain

_install_and_load_buddypress()

_install_and_load_buddypress() 
package BuddyPress

_load_buddypress()

_load_buddypress() 
package BuddyPress

Callback to convert email address match to HTML A element.

_make_email_clickable_cb(array $matches) : string

This function was backported from 2.5.0 to 2.3.2. Regex callback for {@link make_clickable()}.

package BuddyPress
since 2.3.2
access private

Parameters

$matches

array

Single Regex Match.

Returns

stringHTML A element with email address.

Callback to convert URI match to HTML A element.

_make_url_clickable_cb(array $matches) : string

This function was backported from 2.5.0 to 2.3.2. Regex callback for {@link make_clickable()}.

package BuddyPress
since 2.3.2
access private

Parameters

$matches

array

Single Regex Match.

Returns

stringHTML A element with URI address.

Callback to convert URL match to HTML A element.

_make_web_ftp_clickable_cb(array $matches) : string

This function was backported from 2.5.0 to 2.3.2. Regex callback for {@link make_clickable()}.

package BuddyPress
since 2.3.2
access private

Parameters

$matches

array

Single Regex Match.

Returns

stringHTML A element with URL address.

Converts a number of special characters into their HTML entities.

_wp_specialchars(string $string, mixed $quote_style = ENT_NOQUOTES, string $charset = false, boolean $double_encode = false) : string

Specifically deals with: &, <, >, ", and '.

$quote_style can be set to ENT_COMPAT to encode " to ", or ENT_QUOTES to do both. Default is ENT_NOQUOTES where no quotes are encoded.

package BuddyPress
since 1.2.2

Parameters

$string

string

The text which is to be encoded.

$quote_style

mixed

Optional. Converts double quotes if set to ENT_COMPAT, both single and double if set to ENT_QUOTES or none if set to ENT_NOQUOTES. Also compatible with old values; converting single quotes if set to 'single', double if set to 'double' or both if otherwise set. Default is ENT_NOQUOTES.

$charset

string

Optional. The character encoding of the string. Default is false.

$double_encode

boolean

Optional. Whether or not to encode existing html entities. Default is false.

Returns

stringThe encoded text with HTML entities.

_wp_timezone_choice_usort_callback()

_wp_timezone_choice_usort_callback($a, $b) 
package BuddyPress

Parameters

$a

$b

Search for disabled element tags. Push element to stack on tag open and pop on tag close. Assumes first character of $text is tag opening.

_wptexturize_pushpop_element(string $text, array $stack, string $disabled_elements, string $opening = '<', $closing = '>') : object
package BuddyPress
access private
since 2.9.0

Parameters

$text

string

Text to check. First character is assumed to be $opening

$stack

array

Array used as stack of opened tag elements

$disabled_elements

string

Tags to match against formatted as regexp sub-expression

$opening

stringstring

Tag opening character, assumed to be 1 character long

$closing

Returns

object

Converts value to nonnegative integer.

absint(mixed $maybeint) : integer
package BuddyPress
since 2.5.0

Parameters

$maybeint

mixed

Data you wish to have convered to an nonnegative integer

Returns

integerAn nonnegative integer

Add blog option.

add_blog_option(integer $blog_id, string $option_name, mixed $option_value) : boolean
package BuddyPress
since 1.2.0
see

Parameters

$blog_id

integer

Blog ID to add for. Not used.

$option_name

string

Option name to add.

$option_value

mixed

Option value to add.

Returns

boolean

Retrieve a modified URL query string.

add_query_arg() : string

You can rebuild the URL and append a new query variable to the URL query by using this function. You can also retrieve the full URL with query data.

Adding a single key & value or an associative array. Setting a key value to emptystring removes the key. Omitting oldquery_or_uri uses the $_SERVER value.

package BuddyPress
since 1.5.0

Returns

stringNew URL query string.

Does the specified module exist in the apache config?

apache_mod_loaded(string $mod, boolean $default = false) : boolean
package BuddyPress
since 2.5.0

Parameters

$mod

string

e.g. mod_rewrite

$default

boolean

The default return value if the module is not found

Returns

boolean

Escaping for HTML attributes.

attribute_escape(string $text) : string
package BuddyPress
since 2.0.6
deprecated 2.8.0
see

Parameters

$text

string

Returns

string

backpress_add_option()

backpress_add_option($option, $value) 
package BuddyPress

Parameters

$option

$value

backpress_convert_object()

backpress_convert_object($object, $output) 
package BuddyPress

Parameters

$object

$output

backpress_delete_option()

backpress_delete_option($option) 
package BuddyPress

Parameters

$option

backpress_delete_transient()

backpress_delete_transient($transient) 
package BuddyPress

Parameters

$transient

Kill BackPress execution and display HTML message with error message.

backpress_die(string $message, string $title = '', string|array $args = array()

This function calls the die() PHP function. The difference is that a message in HTML will be displayed to the user. It is recommended to use this function only when the execution should not continue any further. It is not recommended to call this function very often and normally you should try to handle as many errors as possible silently.

package BuddyPress

Parameters

$message

string

Error message.

$title

string

Error title.

$args

stringarray

Optional arguments to control behaviour.

backpress_get_option()

backpress_get_option($option) 
package BuddyPress

Parameters

$option

backpress_get_transient()

backpress_get_transient($transient) 
package BuddyPress

Parameters

$transient

backpress_gmt_strtotime()

backpress_gmt_strtotime($string) 
package BuddyPress

Parameters

$string

backpress_set_transient()

backpress_set_transient($transient, $value, $expiration = 0
package BuddyPress

Parameters

$transient

$value

$expiration

backpress_update_option()

backpress_update_option($option, $value) 
package BuddyPress

Parameters

$option

$value

Adds backslashes before letters and before a number at the start of a string.

backslashit(string $string) : string
package BuddyPress
since 0.71

Parameters

$string

string

Value to which backslashes will be added.

Returns

stringString with backslashes inserted.

Return the value of a given action variable.

bp_action_variable(integer $position = 0) : string | boolean
package BuddyPress
since 1.5.0

Parameters

$position

integer

The key of the action_variables array that you want.

Returns

stringboolean$action_variable The value of that position in the array, or false if not found.

Return the value of $bp->action_variables.

bp_action_variables() : array | boolean
package BuddyPress
since 1.0.0

Returns

arrayboolean$action_variables The action variables array, or false if the array is empty.

Fire the 'bp_actions' action, which runs just before rendering.

bp_actions() 

Attach potential template actions, such as catching form requests or routing custom URLs.

package BuddyPress
since 1.5.0

Output the activation slug.

bp_activate_slug() 
package BuddyPress
since 1.5.0

Fire activation hooks and events.

bp_activation() 

Runs on BuddyPress activation.

package BuddyPress
since 1.6.0

Output the URL of the activation page.

bp_activation_page() 
package BuddyPress
since 1.0.0

Determine if there are still activities left in the loop.

bp_activities() : boolean
package BuddyPress
since 1.0.0
global BP_Activity_Template $activities_template The main activity template loop class.

Returns

booleanReturns true when activities are found.

{@internal Missing Description}

bp_activities_no_activity() 
package BuddyPress
since 1.0.0
deprecated 12.0.0

Output the activities title.

bp_activities_title() 
package BuddyPress
since 1.0.0
deprecated 12.0.0

Output the activity action.

bp_activity_action(array $args = array()
package BuddyPress
since 1.2.0

Parameters

$args

array

See bp_get_activity_action().

Returns the Allowed HTML tags for the activity action.

bp_activity_action_allowed_html() : array
package BuddyPress
since 12.4.1

Returns

arrayThe Allowed HTML tags for the activity action.

Delete specific activity item and redirect to previous page.

bp_activity_action_delete_activity(integer $activity_id = 0) : boolean
package BuddyPress
since 1.1.0

Parameters

$activity_id

integer

Activity id to be deleted. Defaults to 0.

Returns

booleanFalse on failure.

Load a user's favorites feed.

bp_activity_action_favorites_feed() : boolean
package BuddyPress
since 1.2.0

Returns

booleanFalse on failure.

Load a user's friends' activity feed.

bp_activity_action_friends_feed() : boolean
package BuddyPress
since 1.0.0

Returns

booleanFalse on failure.

Mark activity as favorite.

bp_activity_action_mark_favorite() : boolean
package BuddyPress
since 1.2.0

Returns

booleanFalse on failure.

Load a user's @mentions feed.

bp_activity_action_mentions_feed() : boolean
package BuddyPress
since 1.2.0

Returns

booleanFalse on failure.

Load the activity feed for a user's groups.

bp_activity_action_my_groups_feed() : boolean
package BuddyPress
since 1.2.0

Returns

booleanFalse on failure.

Output the activity action name.

bp_activity_action_name() 

Just a wrapper for bp_activity_type().

package BuddyPress
since 1.2.0
deprecated 1.5.0
todo Properly deprecate in favor of bp_activity_type() and remove redundant echo

Load a user's personal activity feed.

bp_activity_action_personal_feed() : boolean
package BuddyPress
since 1.0.0

Returns

booleanFalse on failure.

Post new activity comment.

bp_activity_action_post_comment() : boolean
package BuddyPress
since 1.2.0

Returns

booleanFalse on failure.

Post user/group activity update.

bp_activity_action_post_update() : boolean
package BuddyPress
since 1.2.0

Returns

booleanFalse on failure.

Remove activity from favorites.

bp_activity_action_remove_favorite() : boolean
package BuddyPress
since 1.2.0

Returns

booleanFalse on failure.

Load the sitewide activity feed.

bp_activity_action_sitewide_feed() : boolean
package BuddyPress
since 1.0.0

Returns

booleanFalse on failure.

Mark specific activity item as spam and redirect to previous page.

bp_activity_action_spam_activity(integer $activity_id = 0) : boolean
package BuddyPress
since 1.6.0

Parameters

$activity_id

integer

Activity id to be deleted. Defaults to 0.

Returns

booleanFalse on failure.

Add an activity item.

bp_activity_add(array|string $args = '') : \WP_Error | boolean | integer
package BuddyPress
since 1.1.0
since 2.6.0 Added 'error_type' parameter to $args.

Parameters

$args

arraystring

{ An array of arguments. @type int|bool $id Pass an activity ID to update an existing item, or false to create a new item. Default: false. @type string $action Optional. The activity action/description, typically something like "Joe posted an update". Values passed to this param will be stored in the database and used as a fallback for when the activity item's format_callback cannot be found (eg, when the component is disabled). As long as you have registered a format_callback for your $type, it is unnecessary to include this argument - BP will generate it automatically. See {@link bp_activity_set_action()}. @type string $content Optional. The content of the activity item. @type string $component The unique name of the component associated with the activity item - 'groups', 'profile', etc. @type string $type The specific activity type, used for directory filtering. 'new_blog_post', 'activity_update', etc. @type string $primary_link Optional. The URL for this item, as used in RSS feeds. Defaults to the URL for this activity item's permalink page. @type int|bool $user_id Optional. The ID of the user associated with the activity item. May be set to false or 0 if the item is not related to any user. Default: the ID of the currently logged-in user. @type int $item_id Optional. The ID of the associated item. @type int $secondary_item_id Optional. The ID of a secondary associated item. @type string $date_recorded Optional. The GMT time, in Y-m-d h:i:s format, when the item was recorded. Defaults to the current time. @type bool $hide_sitewide Should the item be hidden on sitewide streams? Default: false. @type bool $is_spam Should the item be marked as spam? Default: false. @type string $error_type Optional. Error type. Either 'bool' or 'wp_error'. Default: 'bool'. }

Returns

\WP_ErrorbooleanintegerThe ID of the activity on success. False on error.

Register the Activity component admin screen.

bp_activity_add_admin_menu() 
package BuddyPress
since 1.6.0

Add a piece of activity metadata.

bp_activity_add_meta(integer $activity_id, string $meta_key, mixed $meta_value, boolean $unique = false) : integer | boolean
package BuddyPress
since 2.0.0

Parameters

$activity_id

integer

ID of the activity item.

$meta_key

string

Metadata key.

$meta_value

mixed

Metadata value.

$unique

boolean

Optional. Whether to enforce a single metadata value for the given key. If true, and the object already has a value for the key, no change will be made. Default: false.

Returns

integerbooleanThe meta ID on successful update, false on failure.

Add a notification for post comments to the post author or post commenter.

bp_activity_add_notification_for_synced_blog_comment(integer $activity_id, \WP_Comment $post_type_comment, array $activity_args, object $activity_post_object) 

Requires "activity stream commenting on posts and comments" to be enabled.

package BuddyPress
since 2.6.0

Parameters

$activity_id

integer

The activity comment ID.

$post_type_comment

\WP_Comment

WP Comment object.

$activity_args

array

Activity comment arguments.

$activity_post_object

object

The post type tracking args object.

Add an activity stream item as a favorite for a user.

bp_activity_add_user_favorite(integer $activity_id, integer $user_id = 0) : boolean
package BuddyPress
since 1.2.0

Parameters

$activity_id

integer

ID of the activity item being favorited.

$user_id

integer

ID of the user favoriting the activity item.

Returns

boolean

Adjusts mention count for mentioned users in activity items.

bp_activity_adjust_mention_count(integer $activity_id = 0, string $action = 'add') : boolean

This function is useful if you only have the activity ID handy and you haven't parsed an activity item for @mentions yet.

Currently, only used in bp_activity_delete().

package BuddyPress
since 1.5.0

Parameters

$activity_id

integer

The unique id for the activity item.

$action

string

Can be 'delete' or 'add'. Defaults to 'add'.

Returns

boolean

Output the Activity component admin screens.

bp_activity_admin() 
package BuddyPress
since 1.6.0

Display the Activity delete confirmation screen.

bp_activity_admin_delete() 
package BuddyPress
since 7.0.0

Display the single activity edit screen.

bp_activity_admin_edit() 
package BuddyPress
since 1.6.0

Hide the advanced edit meta boxes by default, so we don't clutter the screen.

bp_activity_admin_edit_hidden_metaboxes(array $hidden, \WP_Screen $screen) : array
package BuddyPress
since 1.6.0

Parameters

$hidden

array

Array of items to hide.

$screen

\WP_Screen

Screen identifier.

Returns

arrayHidden Meta Boxes.

Primary item ID/Secondary item ID metabox for the Activity admin edit screen.

bp_activity_admin_edit_metabox_itemids(object $item) 
package BuddyPress
since 1.6.0

Parameters

$item

object

Activity item.

Status metabox for the Activity admin edit screen.

bp_activity_admin_edit_metabox_status(object $item) 
package BuddyPress
since 1.6.0

Parameters

$item

object

Activity item.

Activity type metabox for the Activity admin edit screen.

bp_activity_admin_edit_metabox_type(object $item) 
package BuddyPress
since 1.6.0

Parameters

$item

object

Activity item.

User ID metabox for the Activity admin edit screen.

bp_activity_admin_edit_metabox_userid(object $item) 
package BuddyPress
since 1.6.0

Parameters

$item

object

Activity item.

Get flattened array of all registered activity actions.

bp_activity_admin_get_activity_actions() : array

Format is [activity_type] => Pretty name for activity type.

package BuddyPress
since 2.0.0

Returns

array$actions

Display the Activity admin index screen, which contains a list of all the activities.

bp_activity_admin_index() 
package BuddyPress
since 1.6.0
global BP_Activity_List_Table $bp_activity_list_table Activity screen list table.
global string $plugin_page The current plugin page.

Set up the Activity admin page.

bp_activity_admin_load() 

Does the following:

  • Register contextual help and screen options for this admin page.
  • Enqueues scripts and styles.
  • Catches POST and GET requests related to Activity.
package BuddyPress
since 1.6.0
global BP_Activity_List_Table $bp_activity_list_table Activity screen list table.

Add the Activity top-level menu link when viewing single activity item.

bp_activity_admin_menu() : null
package BuddyPress
since 2.6.0
global WP_Admin_Bar $wp_admin_bar Core class used to implement the Toolbar API.

Returns

nullNull if user does not have access to editing functionality.

Add activity component to custom menus array.

bp_activity_admin_menu_order(array $custom_menus = array()) : array

Several BuddyPress components have top-level menu items in the Dashboard, which all appear together in the middle of the Dashboard menu. This function adds the Activity page to the array of these menu items.

package BuddyPress
since 1.7.0

Parameters

$custom_menus

array

The list of top-level BP menu items.

Returns

array$custom_menus List of top-level BP menu items, with Activity added.

AJAX receiver for Activity replies via the admin screen.

bp_activity_admin_reply() 

Processes requests to add new activity comments, and echoes HTML for a new table row.

package BuddyPress
since 1.6.0

Handle save/update of screen options for the Activity component admin screen.

bp_activity_admin_screen_options(string $value, string $option, string $new_value) : string | integer
package BuddyPress
since 1.6.0
deprecated 14.0.0

Parameters

$value

string

Will always be false unless another plugin filters it first.

$option

string

Screen option name.

$new_value

string

Screen option form value.

Returns

stringintegerOption value. False to abandon update.

Notify a member when their nicename is mentioned in an activity stream item.

bp_activity_at_mention_add_notification(object $activity, string $subject, string $message, string $content, integer $receiver_user_id) 

Hooked to the 'bp_activity_sent_mention_email' action, we piggy back off the existing email code for now, since it does the heavy lifting for us. In the future when we separate emails from Notifications, this will need its own 'bp_activity_at_name_send_emails' equivalent helper function.

package BuddyPress
since 1.9.0

Parameters

$activity

object

Activity object.

$subject

string

(not used) Notification subject.

$message

string

(not used) Notification message.

$content

string

(not used) Notification content.

$receiver_user_id

integer

ID of user receiving notification.

Delete at-mention notifications when the corresponding activity item is deleted.

bp_activity_at_mention_delete_notification(array $activity_ids_deleted = array()
package BuddyPress
since 2.0.0

Parameters

$activity_ids_deleted

array

IDs of deleted activity items.

Send email and BP notifications when a user is mentioned in an update.

bp_activity_at_message_notification(integer $activity_id, integer $receiver_user_id) 
package BuddyPress
since 1.2.0

Parameters

$activity_id

integer

The ID of the activity update.

$receiver_user_id

integer

The ID of the user who is receiving the update.

Find and link @-mentioned users in the contents of a given item.

bp_activity_at_name_filter(string $content, integer $activity_id = 0) : string
package BuddyPress
since 1.2.0

Parameters

$content

string

The contents of a given item.

$activity_id

integer

The activity id. Deprecated.

Returns

string$content Content filtered for mentions.

Catch mentions in an activity item before it is saved into the database.

bp_activity_at_name_filter_updates(\BP_Activity_Activity $activity) 

If mentions are found, replace @mention text with user links and add our hook to send mention notifications after the activity item is saved.

package BuddyPress
since 1.5.0

Parameters

$activity

\BP_Activity_Activity

Activity Object.

Sends emails and BP notifications for users @-mentioned in an activity item.

bp_activity_at_name_send_emails(\BP_Activity_Activity $activity) 
package BuddyPress
since 1.7.0

Parameters

$activity

\BP_Activity_Activity

The BP_Activity_Activity object.

Output the avatar of the user that performed the action.

bp_activity_avatar(array|string $args = ''
package BuddyPress
since 1.1.0
see for description of arguments.

Parameters

$args

arraystring

See {@link bp_get_activity_avatar()} for description.

Determine if a comment can be made on an activity item.

bp_activity_can_comment() : boolean
package BuddyPress
since 1.2.0
global BP_Activity_Template $activities_template The main activity template loop class.

Returns

boolean$can_comment True if item can receive comments.

Determine whether a comment can be made on an activity reply item.

bp_activity_can_comment_reply(boolean|object $comment = false) : boolean
package BuddyPress
since 1.5.0

Parameters

$comment

booleanobject

Activity comment.

Returns

boolean$can_comment True if comment can receive comments, otherwise false.

Determine whether favorites are allowed.

bp_activity_can_favorite() : boolean

Defaults to true, but can be modified by plugins.

package BuddyPress
since 1.5.0

Returns

booleanTrue if comment can receive comments.

Detect a change in post type status, and initiate an activity update if necessary.

bp_activity_catch_transition_post_type_status(string $new_status, string $old_status, object $post) 
package BuddyPress
since 2.2.0
todo Support untrashing better.

Parameters

$new_status

string

New status for the post.

$old_status

string

Old status for the post.

$post

object

Post data.

Mark the posted activity as spam, if it contains disallowed keywords.

bp_activity_check_blacklist_keys(\BP_Activity_Activity $activity) 

Use bp_activity_check_disallowed_keys() instead.

package BuddyPress
since 1.6.0
deprecated 7.0.0

Parameters

$activity

\BP_Activity_Activity

The activity object to check.

Mark the posted activity as spam, if it contains disallowed keywords.

bp_activity_check_disallowed_keys(\BP_Activity_Activity $activity) 
package BuddyPress
since 7.0.0

Parameters

$activity

\BP_Activity_Activity

The activity object to check.

Check whether an activity item exists with a given content string.

bp_activity_check_exists_by_content(string $content) : integer | null
package BuddyPress
since 1.1.0

Parameters

$content

string

The content to filter by.

Returns

integernullThe ID of the located activity item. Null if none is found.

Moderate the posted activity item, if it contains moderate keywords.

bp_activity_check_moderation_keys(\BP_Activity_Activity $activity) 
package BuddyPress
since 1.6.0

Parameters

$activity

\BP_Activity_Activity

The activity object to check.

Clear a cached activity item when that item is updated.

bp_activity_clear_cache_for_activity(\BP_Activity_Activity $activity) 
package BuddyPress
since 2.0.0

Parameters

$activity

\BP_Activity_Activity

Activity object.

Clear cached data for deleted activity items.

bp_activity_clear_cache_for_deleted_activity(array $deleted_ids) 
package BuddyPress
since 2.0.0

Parameters

$deleted_ids

array

IDs of deleted activity items.

bp_activity_clear_meta_cache_for_activity()

bp_activity_clear_meta_cache_for_activity() 
package BuddyPress
deprecated 2.0.0

Reset a user's unread mentions list and count.

bp_activity_clear_new_mentions(integer $user_id) 
package BuddyPress
since 1.5.0

Parameters

$user_id

integer

The id of the user whose unread mentions are being reset.

Outputs the URL to cancel a comment.

bp_activity_comment_cancel_url() 
package BuddyPress
since 12.0.0

Output the content of the activity comment currently being displayed.

bp_activity_comment_content() 
package BuddyPress
since 1.5.0

Output the activity comment count.

bp_activity_comment_count() 
package BuddyPress
since 1.2.0

Output the formatted date_recorded of the activity comment currently being displayed.

bp_activity_comment_date_recorded() 
package BuddyPress
since 1.5.0

Output the date_recorded of the activity comment currently being displayed.

bp_activity_comment_date_recorded_raw() 
package BuddyPress
since 2.3.0

Output the depth of the current activity comment.

bp_activity_comment_depth(object|integer $comment = 0
package BuddyPress
since 2.0.0
since 2.8.0 Added $comment as a parameter.

Parameters

$comment

objectinteger

Object of the activity comment or activity comment ID. Usually unnecessary when used in activity comment loop.

Set up activity oEmbed cache while recursing through activity comments.

bp_activity_comment_embed() 

While crawling through an activity comment tree (\bp_activity_recurse_comments), this function sets up the hooks necessary to grab each comment's embeds from the cache, or put them in the cache if they are not there yet.

package BuddyPress
since 1.5.0
see
see
see

Clean up 'embed_post_id' filter after comment recursion.

bp_activity_comment_embed_after_recurse() 

This filter must be removed so that the non-comment filters take over again once the comments are done being processed.

package BuddyPress
since 1.5.0
see

Output the activity comment form action.

bp_activity_comment_form_action() 
package BuddyPress
since 1.2.0

Output the activity comment form no JavaScript display CSS.

bp_activity_comment_form_nojs_display() 
package BuddyPress
since 1.2.0

Output the ID of the activity comment currently being displayed.

bp_activity_comment_id() 
package BuddyPress
since 1.5.0

Output the author name for the activity comment currently being displayed.

bp_activity_comment_name() 
package BuddyPress
since 1.5.0

Notify a member one of their activity comment received a reply.

bp_activity_comment_reply_add_notification(\BP_Activity_Activity $activity_comment, integer $comment_id, integer $commenter_id) 
package BuddyPress
since 2.6.0

Parameters

$activity_comment

\BP_Activity_Activity

The parent activity.

$comment_id

integer

ID for the newly received comment.

$commenter_id

integer

ID of the user who made the comment.

Output the ID of the author of the activity comment currently being displayed.

bp_activity_comment_user_id() 
package BuddyPress
since 1.5.0

Output the comment markup for an activity item.

bp_activity_comments(array|string $deprecated = ''
package BuddyPress
since 1.2.0

Parameters

$deprecated

arraystring

See {@link bp_activity_get_comments} for description.

Echo a list of linked avatars of users who have commented on the current activity item.

bp_activity_comments_user_avatars(array $args = array()

Use this function to easily output activity comment authors' avatars.

Avatars are wrapped in

  • elements, but you've got to provide your own

      or
        wrapper markup.
  • package BuddyPress
    since 1.7.0
    see for a description of arguments.

    Parameters

    $args

    array

    See {@link bp_core_fetch_avatar()}.

    Output the activity content.

    bp_activity_content() 
    package BuddyPress
    since 1.0.0
    deprecated 1.5.0
    todo properly deprecate this function.

    Output the activity content body.

    bp_activity_content_body() 
    package BuddyPress
    since 1.2.0

    Output the activity count.

    bp_activity_count() 
    package BuddyPress
    since 1.2.0

    Create a rich summary of an activity item for the activity stream.

    bp_activity_create_summary(string $content, array $activity) : string

    More than just a simple excerpt, the summary could contain oEmbeds and other types of media. Currently, it's only used for blog post items, but it will probably be used for all types of activity in the future.

    package BuddyPress
    since 2.3.0

    Parameters

    $content

    string

    The content of the activity item.

    $activity

    array

    The data passed to bp_activity_add() or the values from an Activity obj.

    Returns

    string$summary

    Output the activity CSS class.

    bp_activity_css_class() 
    package BuddyPress
    since 1.0.0

    Utility function that returns the comment currently being recursed.

    bp_activity_current_comment() : object | boolean
    package BuddyPress
    since 1.5.0
    global BP_Activity_Template $activities_template The main activity template loop class.

    Returns

    objectboolean$current_comment The activity comment currently being displayed. False on failure.

    Output the date the activity was recorded.

    bp_activity_date_recorded() 
    package BuddyPress
    since 1.2.0

    Delete activity item(s).

    bp_activity_delete(array|string $args = '') : boolean

    If you're looking to hook into one action that provides the ID(s) of the activity/activities deleted, then use:

    add_action( 'bp_activity_deleted_activities', 'my_function' );

    The action passes one parameter that is a single activity ID or an array of activity IDs depending on the number deleted.

    If you are deleting an activity comment please use bp_activity_delete_comment();

    package BuddyPress
    since 1.0.0
    see For more information on accepted arguments.

    Parameters

    $args

    arraystring

    To delete specific activity items, use $args = array( 'id' => $ids ); Otherwise, to use filters for item deletion, the argument format is the same as BP_Activity_Activity::get(). See that method for a description.

    Returns

    boolean

    Delete an activity item by activity id.

    bp_activity_delete_by_activity_id(integer $activity_id) : boolean
    package BuddyPress
    since 1.1.0

    Parameters

    $activity_id

    integer

    ID of the activity item to be deleted.

    Returns

    boolean

    Delete an activity item by its content.

    bp_activity_delete_by_content(integer $user_id, string $content, string $component, string $type) : boolean

    You should use bp_activity_delete() instead.

    package BuddyPress
    since 1.1.0
    deprecated 1.2.0

    Parameters

    $user_id

    integer

    The user id.

    $content

    string

    The activity id.

    $component

    string

    The activity component.

    $type

    string

    The activity type.

    Returns

    boolean

    Delete an activity item by activity id.

    bp_activity_delete_by_item_id(array|string $args = '') : boolean

    You should use bp_activity_delete() instead.

    package BuddyPress
    since 1.1.0
    deprecated 1.2.0

    Parameters

    $args

    arraystring

    See BP_Activity_Activity::get for a description of accepted arguments.

    Returns

    boolean

    Delete an activity comment's children.

    bp_activity_delete_children(integer $activity_id, integer $comment_id) 
    package BuddyPress
    since 1.2.0

    Parameters

    $activity_id

    integer

    The ID of the "root" activity, ie the comment's oldest ancestor.

    $comment_id

    integer

    The ID of the comment to be deleted.

    Delete an activity comment.

    bp_activity_delete_comment(integer $activity_id, integer $comment_id) : boolean
    package BuddyPress
    since 1.2.0
    todo Why is an activity id required? We could look this up.
    todo Why do we encourage users to call this function directly? We could just as easily examine the activity type in bp_activity_delete() and then call this function with the proper arguments if necessary.

    Parameters

    $activity_id

    integer

    The ID of the "root" activity, ie the comment's oldest ancestor.

    $comment_id

    integer

    The ID of the comment to be deleted.

    Returns

    boolean

    Delete a user's activity for a component.

    bp_activity_delete_for_user_by_component(integer $user_id, string $component) : boolean

    You should use bp_activity_delete() instead.

    package BuddyPress
    since 1.1.0
    deprecated 1.2.0

    Parameters

    $user_id

    integer

    The user id.

    $component

    string

    The activity component.

    Returns

    boolean

    Delete a meta entry from the DB for an activity stream item.

    bp_activity_delete_meta(integer $activity_id, string $meta_key = '', string $meta_value = '', boolean $delete_all = false) : boolean
    package BuddyPress
    since 1.2.0

    Parameters

    $activity_id

    integer

    ID of the activity item whose metadata is being deleted.

    $meta_key

    string

    Optional. The key of the metadata being deleted. If omitted, all metadata associated with the activity item will be deleted.

    $meta_value

    string

    Optional. If present, the metadata will only be deleted if the meta_value matches this parameter.

    $delete_all

    boolean

    Optional. If true, delete matching metadata entries for all objects, ignoring the specified object_id. Otherwise, only delete matching metadata entries for the specified activity item. Default: false.

    Returns

    boolean

    Output the URL to delete a single activity stream item.

    bp_activity_delete_url() 
    package BuddyPress
    since 2.1.0

    Should we use Heartbeat to refresh activities?

    bp_activity_do_heartbeat() : boolean
    package BuddyPress
    since 2.0.0

    Returns

    booleanTrue if activity heartbeat is enabled, otherwise false.

    Are mentions enabled or disabled?

    bp_activity_do_mentions() : boolean

    The Mentions feature does a number of things, all of which will be turned off if you disable mentions:

    • Detecting and auto-linking @username in all BP/WP content.
    • Sending BP notifications and emails to users when they are mentioned using the @username syntax.
    • The Public Message button on user profiles.

    Mentions are enabled by default. To disable, put the following line in bp-custom.php or your theme's functions.php file:

    add_filter( 'bp_activity_do_mentions', '__return_false' );

    package BuddyPress
    since 1.8.0

    Returns

    boolean$retval True to enable mentions, false to disable.

    Set up activity oEmbed cache during the activity loop.

    bp_activity_embed() 

    During an activity loop, this function sets up the hooks necessary to grab each item's embeds from the cache, or put them in the cache if they are not there yet.

    This does not cover recursive activity comments, as they do not use a real loop. For that, see bp_activity_comment_embed().

    package BuddyPress
    since 1.5.0
    see
    see
    see

    Add inline styles for BP activity embeds.

    bp_activity_embed_add_inline_styles() 
    package BuddyPress
    since 2.6.0

    Outputs excerpt for an activity embed item.

    bp_activity_embed_excerpt($content = ''
    package BuddyPress
    since 2.6.0

    Parameters

    $content

    Catch links in embed excerpt so top.location.href can be added.

    bp_activity_embed_excerpt_onclick_location_filter(string $text) : string

    Due to