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