Functions

__()

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

Parameters

$text

$domain

__n()

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

Parameters

$singular

$plural

$count

$domain

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
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.

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) : mixed
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

mixed

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 object $activities_template {@link BP_Activity_Template}

Returns

booleanReturns true when activities are found.

{@internal Missing Description}

bp_activities_no_activity()