[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-core/ -> bp-core-functions.php (summary)

BuddyPress Common Functions.

File Size: 4676 lines (156 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 118 functions

  bp_version()
  bp_get_version()
  bp_db_version()
  bp_get_db_version()
  bp_db_version_raw()
  bp_get_db_version_raw()
  bp_is_running_wp()
  bp_core_get_table_prefix()
  bp_sort_by_key()
  bp_alpha_sort_by_key()
  bp_core_number_format()
  bp_core_parse_args_array()
  bp_parse_args()
  bp_sanitize_pagination_arg()
  bp_esc_sql_order()
  bp_esc_like()
  bp_is_username_compatibility_mode()
  bp_use_wp_admin_bar()
  bp_forums_parent_forum_id()
  bp_core_get_packaged_component_ids()
  bp_core_get_directory_page_ids()
  bp_core_get_directory_page_id()
  bp_core_update_directory_page_ids()
  bp_core_get_directory_pages()
  bp_core_add_page_mappings()
  bp_core_get_directory_page_default_titles()
  bp_core_on_directory_page_delete()
  bp_core_component_slug_from_root_slug()
  bp_core_add_root_component()
  bp_core_create_root_component_page()
  bp_core_get_component_search_query_arg()
  bp_core_get_active_components()
  bp_do_register_theme_directory()
  bp_core_get_root_domain()
  bp_core_redirect()
  bp_get_referer_path()
  bp_core_get_site_path()
  bp_core_current_time()
  bp_core_time_diff()
  bp_core_time_since()
  bp_core_time_old()
  bp_core_iso8601_date()
  bp_core_get_iso8601_date()
  bp_core_add_message()
  bp_core_setup_message()
  bp_core_render_message()
  bp_core_record_activity()
  bp_core_get_last_activity()
  bp_get_user_meta_key()
  bp_get_user_meta()
  bp_update_user_meta()
  bp_delete_user_meta()
  bp_embed_init()
  bp_use_embed_in_activity()
  bp_use_embed_in_activity_replies()
  bp_use_embed_in_private_messages()
  bp_core_extract_media_from_content()
  bp_admin_url()
  bp_get_admin_url()
  bp_core_do_network_admin()
  bp_core_admin_hook()
  bp_is_root_blog()
  bp_get_root_blog_id()
  bp_is_multiblog_mode()
  bp_is_network_activated()
  bp_update_is_directory()
  bp_update_is_item_admin()
  bp_update_is_item_mod()
  bp_do_404()
  bp_verify_nonce_request()
  bp_is_post_request()
  bp_is_get_request()
  bp_core_load_buddypress_textdomain()
  bp_core_action_search_site()
  bp_remove_adjacent_posts_rel_link()
  _bp_strip_spans_from_title()
  bp_core_get_minified_asset_suffix()
  bp_core_get_components()
  bp_nav_menu_get_loggedin_pages()
  bp_nav_menu_get_loggedout_pages()
  bp_nav_menu_get_item_url()
  bp_core_get_suggestions()
  bp_ajax_get_suggestions()
  bp_upload_dir()
  bp_email_post_type()
  bp_get_email_post_type()
  bp_get_email_post_type_labels()
  bp_get_email_post_type_supports()
  bp_get_taxonomy_common_args()
  bp_get_taxonomy_common_labels()
  bp_email_tax_type()
  bp_get_email_tax_type()
  bp_get_email_tax_type_labels()
  bp_get_email_tax_type_args()
  bp_get_type_metadata_schema()
  bp_register_type_meta()
  bp_update_type_metadata()
  bp_get_taxonomy_types()
  bp_get_email()
  bp_send_email()
  bp_email_get_appearance_settings()
  bp_email_get_template()
  bp_core_replace_tokens_in_text()
  bp_email_get_schema()
  bp_email_get_type_schema()
  bp_email_unsubscribe_handler()
  bp_email_get_unsubscribe_link()
  bp_email_get_salt()
  bp_email_get_unsubscribe_type_schema()
  bp_email_get_type()
  bp_get_allowedtags()
  bp_strip_script_and_style_tags()
  bp_is_large_install()
  bp_get_widget_max_count_limit()
  bp_add_optout()
  bp_get_optouts()
  bp_user_has_opted_out()
  bp_delete_optout_by_id()

Functions
Functions that are not part of a class:

bp_version()   X-Ref
Output the BuddyPress version.

since: 1.6.0

bp_get_version()   X-Ref
Return the BuddyPress version.

return: string The BuddyPress version.
since: 1.6.0

bp_db_version()   X-Ref
Output the BuddyPress database version.

since: 1.6.0

bp_get_db_version()   X-Ref
Return the BuddyPress database version.

return: string The BuddyPress database version.
since: 1.6.0

bp_db_version_raw()   X-Ref
Output the BuddyPress database version.

since: 1.6.0

bp_get_db_version_raw()   X-Ref
Return the BuddyPress database version.

return: string The BuddyPress version direct from the database.
since: 1.6.0

bp_is_running_wp( $version, $compare = '>=' )   X-Ref
Check whether the current version of WP exceeds a given version.

return: bool
param: string $version WP version, in "PHP-standardized" format.
param: string $compare Optional. Comparison operator. Default '>='.
since: 7.0.0

bp_core_get_table_prefix()   X-Ref
Get the $wpdb base prefix, run through the 'bp_core_get_table_prefix' filter.

The filter is intended primarily for use in multinetwork installations.

return: string Filtered database prefix.
since: 1.2.6

bp_sort_by_key( $items, $key, $type = 'alpha', $preserve_keys = false )   X-Ref
Sort an array of objects or arrays by a specific key/property.

The main purpose for this function is so that you can avoid having to create
your own awkward callback function for usort().

return: array $items The sorted array.
param: array      $items         The items to be sorted. Its constituent items
param: string|int $key           The array index or property name to sort by.
param: string     $type          Sort type. 'alpha' for alphabetical, 'num'
param: bool       $preserve_keys Whether to keep the keys or not.
since: 2.2.0
since: 2.7.0 Added $preserve_keys parameter.

bp_alpha_sort_by_key( $items, $key )   X-Ref
Sort an array of objects or arrays by alphabetically sorting by a specific key/property.

For instance, if you have an array of WordPress post objects, you can sort
them by post_name as follows:
$sorted_posts = bp_alpha_sort_by_key( $posts, 'post_name' );

return: array $items The sorted array.
param: array      $items The items to be sorted. Its constituent items can be either associative arrays or objects.
param: string|int $key   The array index or property name to sort by.
since: 1.9.0

bp_core_number_format( $number = 0, $decimals = false )   X-Ref
Format numbers the BuddyPress way.

return: string The formatted number.
param: int  $number   The number to be formatted.
param: bool $decimals Whether to use decimals. See {@link number_format_i18n()}.
since: 1.2.0

bp_core_parse_args_array( $old_args_keys, $func_args )   X-Ref
A utility for parsing individual function arguments into an array.

The purpose of this function is to help with backward compatibility in cases where

function foo( $bar = 1, $baz = false, $barry = array(), $blip = false ) { // ...

is deprecated in favor of

function foo( $args = array() ) {
$defaults = array(
'bar'  => 1,
'arg2' => false,
'arg3' => array(),
'arg4' => false,
);
$r = bp_parse_args( $args, $defaults ); // ...

The first argument, $old_args_keys, is an array that matches the parameter positions (keys) to
the new $args keys (values):

$old_args_keys = array(
0 => 'bar', // because $bar was the 0th parameter for foo()
1 => 'baz', // because $baz was the 1st parameter for foo()
2 => 'barry', // etc
3 => 'blip'
);

For the second argument, $func_args, you should just pass the value of func_get_args().

return: array $new_args The parsed arguments.
param: array $old_args_keys Old argument indexes, keyed to their positions.
param: array $func_args     The parameters passed to the originating function.
since: 1.6.0

bp_parse_args( $args, $defaults = array()   X-Ref
Merge user defined arguments into defaults array.

This function is used throughout BuddyPress to allow for either a string or
array to be merged into another array. It is identical to wp_parse_args()
except it allows for arguments to be passively or aggressively filtered using
the optional $filter_key parameter. If no $filter_key is passed, no filters
are applied.

return: array Merged user defined values with defaults.
param: string|array $args       Value to merge with $defaults.
param: array        $defaults   Array that serves as the defaults.
param: string       $filter_key String to key the filters from.
since: 2.0.0

bp_sanitize_pagination_arg( $page_arg = '', $page = 1 )   X-Ref
Sanitizes a pagination argument based on both the request override and the
original value submitted via a query argument, likely to a template class
responsible for limiting the result set of a template loop.

return: int A sanitized integer value, good for pagination.
param: string $page_arg The $_REQUEST argument to look for.
param: int    $page     The original page value to fall back to.
since: 2.2.0

bp_esc_sql_order( $order = '' )   X-Ref
Sanitize an 'order' parameter for use in building SQL queries.

Strings like 'DESC', 'desc', ' desc' will be interpreted into 'DESC'.
Everything else becomes 'ASC'.

return: string The sanitized value 'DESC' or 'ASC'.
param: string $order The 'order' string, as passed to the SQL constructor.
since: 1.8.0

bp_esc_like( $text )   X-Ref
Escape special characters in a SQL LIKE clause.

In WordPress 4.0, like_escape() was deprecated, due to incorrect
documentation and improper sanitization leading to a history of misuse. To
maintain compatibility with versions of WP before 4.0, we duplicate the
logic of the replacement, wpdb::esc_like().

return: string Text in the form of a LIKE phrase. Not SQL safe. Run through
param: string $text The raw text to be escaped.
since: 2.1.0

bp_is_username_compatibility_mode()   X-Ref
Are we running username compatibility mode?

return: bool False when compatibility mode is disabled, true when enabled.
since: 1.5.0

bp_use_wp_admin_bar()   X-Ref
Should we use the WP Toolbar?

The WP Toolbar, introduced in WP 3.1, is fully supported in BuddyPress as
of BP 1.5. For BP 1.6, the WP Toolbar is the default.

return: bool Default: true. False when WP Toolbar support is disabled.
since: 1.5.0

bp_forums_parent_forum_id()   X-Ref
Return the parent forum ID for the Legacy Forums abstraction layer.

return: int Forum ID.
since: 1.5.0
since: 3.0.0 Supported for compatibility with bbPress 2.

bp_core_get_packaged_component_ids()   X-Ref
Returns an array of core component IDs.

return: array
since: 2.1.0

bp_core_get_directory_page_ids( $status = 'active' )   X-Ref
Fetch a list of BP directory pages from the appropriate meta table.

return: array|string An array of page IDs, keyed by component names, or an
param: string $status 'active' to return only pages associated with active components, 'all' to return all saved
since: 1.5.0
since: 10.0.0 Eventually switch the current site to BP root's one on multisite configs.

bp_core_get_directory_page_id( $component = null )   X-Ref
Get the page ID corresponding to a component directory.

return: int|false The ID of the directory page associated with the component. False if none is found.
param: string|null $component The slug representing the component. Defaults to the current component.
since: 2.6.0

bp_core_update_directory_page_ids( $blog_page_ids )   X-Ref
Store the list of BP directory pages in the appropriate meta table.

The bp-pages data is stored in site_options (falls back to options on non-MS),
in an array keyed by blog_id. This allows you to change your
bp_get_root_blog_id() and go through the setup process again.

param: array $blog_page_ids The IDs of the WP pages corresponding to BP
since: 1.5.0

bp_core_get_directory_pages()   X-Ref
Get names and slugs for BuddyPress component directory pages.

return: object Page names, IDs, and slugs.
since: 1.5.0

bp_core_add_page_mappings( $components, $existing = 'keep' )   X-Ref
Creates necessary directory pages.

Directory pages are those WordPress pages used by BP components to display
content (eg, the 'groups' page created by BP).

param: array  $components Components to create pages for.
param: string $existing   'delete' if you want to delete existing page mappings
since: 1.7.0

bp_core_get_directory_page_default_titles()   X-Ref
Get the default page titles for BP directory pages.

return: array
since: 2.7.0

bp_core_on_directory_page_delete( $post_id )   X-Ref
Remove the entry from bp_pages when the corresponding WP page is deleted.

Bails early on multisite installations when not viewing the root site.

param: int $post_id Post ID.
since: 2.2.0

bp_core_component_slug_from_root_slug( $root_slug )   X-Ref
Create a default component slug from a WP page root_slug.

Since 1.5, BP components get their root_slug (the slug used immediately
following the root domain) from the slug of a corresponding WP page.

E.g. if your BP installation at example.com has its members page at
example.com/community/people, $bp->members->root_slug will be
'community/people'.

By default, this function creates a shorter version of the root_slug for
use elsewhere in the URL, by returning the content after the final '/'
in the root_slug ('people' in the example above).

Filter on 'bp_core_component_slug_from_root_slug' to override this method
in general, or define a specific component slug constant (e.g.
BP_MEMBERS_SLUG) to override specific component slugs.

return: string The short slug for use in the middle of URLs.
param: string $root_slug The root slug, which comes from $bp->pages->[component]->slug.
since: 1.5.0

bp_core_add_root_component( $slug )   X-Ref
Add support for a top-level ("root") component.

This function originally (pre-1.5) let plugins add support for pages in the
root of the install. These root level pages are now handled by actual
WordPress pages and this function is now a convenience for compatibility
with the new method.

param: string $slug The slug of the component being added to the root list.
since: 1.0.0

bp_core_create_root_component_page()   X-Ref
Create WordPress pages to be used as BP component directories.

since: 1.5.0

bp_core_get_component_search_query_arg( $component = null )   X-Ref
Get the 'search' query argument for a given component.

return: string|bool Query argument on success. False on failure.
param: string|null $component Optional. Component name. Defaults to current component.
since: 2.4.0
since: 2.7.0 The `$component` parameter was made optional, with the current component

bp_core_get_active_components( $args = array()   X-Ref
Get a list of all active component objects.

return: array A list of component ids or objects.
param: array $args {
param: string $output   Optional. The type of output to return. Accepts 'ids'
param: string $operator Optional. The logical operation to perform. 'or' means only one
since: 8.0.0

bp_do_register_theme_directory()   X-Ref
Determine whether BuddyPress should register the bp-themes directory.

return: bool True if bp-themes should be registered, false otherwise.
since: 1.9.0

bp_core_get_root_domain()   X-Ref
Return the domain for the root blog.

Eg: http://example.com OR https://example.com

return: string The domain URL for the blog.
since: 1.0.0

bp_core_redirect( $location = '', $status = 302 )   X-Ref
Perform a status-safe wp_redirect() that is compatible with BP's URI parser.

param: string $location The redirect URL.
param: int    $status   Optional. The numeric code to give in the redirect
since: 1.0.0

bp_get_referer_path()   X-Ref
Return the URL path of the referring page.

This is a wrapper for `wp_get_referer()` that sanitizes the referer URL to
a webroot-relative path. For example, 'http://example.com/foo/' will be
reduced to '/foo/'.

return: bool|string Returns false on error, a URL path on success.
since: 2.3.0

bp_core_get_site_path()   X-Ref
Get the path of the current site.

return: string URL to the current site.
since: 1.0.0

bp_core_current_time( $gmt = true, $type = 'mysql' )   X-Ref
Get the current GMT time to save into the DB.

return: string Current time in 'Y-m-d h:i:s' format.
param: bool   $gmt  True to use GMT (rather than local) time. Default: true.
param: string $type See the 'type' parameter in {@link current_time()}.
since: 1.2.6

bp_core_time_diff( $args = array()   X-Ref
Calculate the human time difference between two dates.

Based on function created by Dunstan Orchard - http://1976design.com

return: null|array|false Null if there's no time diff. An array containing 1 or 2 chunks
param: array $args {
since: 8.0.0

bp_core_time_since( $older_date, $newer_date = false )   X-Ref
Get an English-language representation of the time elapsed since a given date.

This function will return an English representation of the time elapsed
since a given date.
eg: 2 hours, 50 minutes
eg: 4 days
eg: 4 weeks, 6 days

Note that fractions of minutes are not represented in the return string. So
an interval of 3 minutes will be represented by "3 minutes ago", as will an
interval of 3 minutes 59 seconds.

return: string String representing the time since the older date, eg
param: int|string $older_date The earlier time from which you're calculating
param: int|bool   $newer_date Optional. Unix timestamp of date to compare older
since: 1.0.0
since: 8.0.0 Move the time difference calculation into `bp_core_time_diff()`.

bp_core_time_old( $birth_date )   X-Ref
Get an age to display according to the birth date.

return: string The age to display.
param: int|string $birth_date A timestamp or a MySQL formatted date.
since: 8.0.0

bp_core_iso8601_date( $timestamp = '' )   X-Ref
Output an ISO-8601 date from a date string.

return: string|null
param: string String of date to convert. Timezone should be UTC before using this.
since: 2.7.0

bp_core_get_iso8601_date( $timestamp = '' )   X-Ref
Return an ISO-8601 date from a date string.

return: string
param: string String of date to convert. Timezone should be UTC before using this.
since: 2.7.0

bp_core_add_message( $message, $type = '' )   X-Ref
Add a feedback (error/success) message to the WP cookie so it can be displayed after the page reloads.

param: string $message Feedback message to be displayed.
param: string $type    Message type. 'updated', 'success', 'error', 'warning'.
since: 1.0.0

bp_core_setup_message()   X-Ref
Set up the display of the 'template_notices' feedback message.

Checks whether there is a feedback message in the WP cookie and, if so, adds
a "template_notices" action so that the message can be parsed into the
template and displayed to the user.

After the message is displayed, it removes the message vars from the cookie
so that the message is not shown to the user multiple times.

since: 1.1.0

bp_core_render_message()   X-Ref
Render the 'template_notices' feedback message.

The hook action 'template_notices' is used to call this function, it is not
called directly.

since: 1.1.0

bp_core_record_activity()   X-Ref
Listener function for the logged-in user's 'last_activity' metadata.

Many functions use a "last active" feature to show the length of time since
the user was last active. This function will update that time as a usermeta
setting for the user every 5 minutes while the user is actively browsing the
site.

return: false|null Returns false if there is nothing to do.
since: 1.0.0

bp_core_get_last_activity( $last_activity_date = '', $string = '' )   X-Ref
Format last activity string based on time since date given.

return: string $last_active A string of the form '3 years ago'.
param: int|string $last_activity_date The date of last activity.
param: string     $string             A sprintf()-able statement of the form 'Active %s'.
since: 1.0.0

bp_get_user_meta_key( $key = false )   X-Ref
Get the meta_key for a given piece of user metadata

BuddyPress stores a number of pieces of user data in the WordPress central
usermeta table. In order to allow plugins to enable multiple instances of
BuddyPress on a single WP installation, BP's usermeta keys are filtered
through this function, so that they can be altered on the fly.

Plugin authors should use BP's _user_meta() functions, which bakes in
bp_get_user_meta_key():
$friend_count = bp_get_user_meta( $user_id, 'total_friend_count', true );
If you must use WP's _user_meta() functions directly for some reason, you
should use this function to determine the $key parameter, eg
$friend_count = get_user_meta( $user_id, bp_get_user_meta_key( 'total_friend_count' ), true );
If using the WP functions, do not not hardcode your meta keys.

return: string $key The usermeta meta_key.
param: string|bool $key The usermeta meta_key.
since: 1.5.0

bp_get_user_meta( $user_id, $key, $single = false )   X-Ref
Get a piece of usermeta.

This is a wrapper for get_user_meta() that allows for easy use of
bp_get_user_meta_key(), thereby increasing compatibility with non-standard
BP setups.

return: mixed Will be an array if $single is false. Will be value of meta data field if $single
param: int    $user_id The ID of the user whose meta you're fetching.
param: string $key     The meta key to retrieve.
param: bool   $single  Whether to return a single value.
since: 1.5.0

bp_update_user_meta( $user_id, $key, $value, $prev_value = '' )   X-Ref
Update a piece of usermeta.

This is a wrapper for update_user_meta() that allows for easy use of
bp_get_user_meta_key(), thereby increasing compatibility with non-standard
BP setups.

return: bool False on failure, true on success.
param: int    $user_id    The ID of the user whose meta you're setting.
param: string $key        The meta key to set.
param: mixed  $value      Metadata value.
param: mixed  $prev_value Optional. Previous value to check before removing.
since: 1.5.0

bp_delete_user_meta( $user_id, $key, $value = '' )   X-Ref
Delete a piece of usermeta.

This is a wrapper for delete_user_meta() that allows for easy use of
bp_get_user_meta_key(), thereby increasing compatibility with non-standard
BP setups.

return: bool False for failure. True for success.
param: int    $user_id The ID of the user whose meta you're deleting.
param: string $key     The meta key to delete.
param: mixed  $value   Optional. Metadata value.
since: 1.5.0

bp_embed_init()   X-Ref
Initializes {@link BP_Embed} after everything is loaded.

since: 1.5.0

bp_use_embed_in_activity()   X-Ref
Are oembeds allowed in activity items?

return: bool False when activity embed support is disabled; true when
since: 1.5.0

bp_use_embed_in_activity_replies()   X-Ref
Are oembeds allowed in activity replies?

return: bool False when activity replies embed support is disabled; true
since: 1.5.0

bp_use_embed_in_private_messages()   X-Ref
Are oembeds allowed in private messages?

return: bool False when private message embed support is disabled; true when
since: 1.5.0

bp_core_extract_media_from_content( $content = '', $type = 'all' )   X-Ref
Extracts media metadata from a given content.

return: false|array If media exists, will return array of media metadata. Else, boolean false.
param: string     $content The content to check.
param: string|int $type    The type to check. Can also use a bitmask. See the class constants in the
since: 2.6.0

bp_admin_url( $path = '', $scheme = 'admin' )   X-Ref
Output the correct admin URL based on BuddyPress and WordPress configuration.

param: string $path   See {@link bp_get_admin_url()}.
param: string $scheme See {@link bp_get_admin_url()}.
since: 1.5.0

bp_get_admin_url( $path = '', $scheme = 'admin' )   X-Ref
Return the correct admin URL based on BuddyPress and WordPress configuration.

return: string Admin url link with optional path appended.
param: string $path   Optional. The sub-path under /wp-admin to be
param: string $scheme The scheme to use. Default is 'admin', which
since: 1.5.0

bp_core_do_network_admin()   X-Ref
Should BuddyPress appear in network admin (vs a single site Dashboard)?

Because BuddyPress can be installed in multiple ways and with multiple
configurations, we need to check a few things to be confident about where
to hook into certain areas of WordPress's admin.

return: bool True if the BP admin screen should appear in the Network Admin,
since: 1.5.0

bp_core_admin_hook()   X-Ref
Return the action name that BuddyPress nav setup callbacks should be hooked to.

Functions used to set up BP Dashboard pages (wrapping such admin-panel
functions as add_submenu_page()) should use bp_core_admin_hook() for the
first parameter in add_action(). BuddyPress will then determine
automatically whether to load the panels in the Network Admin. Ie:

add_action( bp_core_admin_hook(), 'myplugin_dashboard_panel_setup' );

return: string $hook The proper hook ('network_admin_menu' or 'admin_menu').
since: 1.5.0

bp_is_root_blog( $blog_id = 0 )   X-Ref
Is this the root blog?

return: bool $is_root_blog Returns true if this is bp_get_root_blog_id().
param: int $blog_id Optional. Default: the ID of the current blog.
since: 1.5.0

bp_get_root_blog_id()   X-Ref
Get the ID of the root blog.

The "root blog" is the blog on a WordPress network where BuddyPress content
appears (where member profile URLs resolve, where a given theme is loaded,
etc.).

return: int The root site ID.
since: 1.5.0

bp_is_multiblog_mode()   X-Ref
Are we running multiblog mode?

Note that BP_ENABLE_MULTIBLOG is different from (but dependent on) WordPress
Multisite. "Multiblog" is BuddyPress setup that allows BuddyPress components
to be viewed on every blog on the network, each with their own settings.

Thus, instead of having all 'boonebgorges' links go to
http://example.com/members/boonebgorges
on the root blog, each blog will have its own version of the same content, eg
http://site2.example.com/members/boonebgorges (for subdomains)
http://example.com/site2/members/boonebgorges (for subdirectories)

Multiblog mode is disabled by default, meaning that all BuddyPress content
must be viewed on the root blog. It's also recommended not to use the
BP_ENABLE_MULTIBLOG constant beyond 1.7, as BuddyPress can now be activated
on individual sites.

Why would you want to use this? Originally it was intended to allow
BuddyPress to live in mu-plugins and be visible on mapped domains. This is
a very small use-case with large architectural shortcomings, so do not go
down this road unless you specifically need to.

return: bool False when multiblog mode is disabled; true when enabled.
since: 1.5.0

bp_is_network_activated()   X-Ref
Is BuddyPress active at the network level for this network?

Used to determine admin menu placement, and where settings and options are
stored. If you're being *really* clever and manually pulling BuddyPress in
with an mu-plugin or some other method, you'll want to filter
'bp_is_network_activated' and override the auto-determined value.

return: bool True if BuddyPress is network activated.
since: 1.7.0

bp_update_is_directory( $is_directory = false, $component = '' )   X-Ref
Set the "is_directory" global.

param: bool   $is_directory Optional. Default: false.
param: string $component    Optional. Component name. Default: the current
since: 1.5.0

bp_update_is_item_admin( $is_item_admin = false, $component = '' )   X-Ref
Set the "is_item_admin" global.

param: bool   $is_item_admin Optional. Default: false.
param: string $component     Optional. Component name. Default: the current
since: 1.5.0

bp_update_is_item_mod( $is_item_mod = false, $component = '' )   X-Ref
Set the "is_item_mod" global.

param: bool   $is_item_mod Optional. Default: false.
param: string $component   Optional. Component name. Default: the current
since: 1.5.0

bp_do_404( $redirect = 'remove_canonical_direct' )   X-Ref
Trigger a 404.

param: string $redirect If 'remove_canonical_direct', remove WordPress' "helpful"
since: 1.5.0

bp_verify_nonce_request( $action = '', $query_arg = '_wpnonce' )   X-Ref
Makes sure the user requested an action from another page on this site.

To avoid security exploits within the theme.

return: bool True if the nonce is verified, otherwise false.
param: string $action    Action nonce.
param: string $query_arg Where to look for nonce in $_REQUEST.
since: 1.6.0

bp_is_post_request()   X-Ref
Return true|false if this is a POST request.

return: bool
since: 1.9.0

bp_is_get_request()   X-Ref
Return true|false if this is a GET request.

return: bool
since: 1.9.0

bp_core_load_buddypress_textdomain()   X-Ref
Load the buddypress translation file for current language.

return: bool True on success, false on failure.
since: 1.0.2

bp_core_action_search_site( $slug = '' )   X-Ref
A JavaScript-free implementation of the search functions in BuddyPress.

param: string $slug The slug to redirect to for searching.
since: 1.0.1
since: 10.0.0 Add support for Activity search.

bp_remove_adjacent_posts_rel_link()   X-Ref
Remove "prev" and "next" relational links from <head> on BuddyPress pages.

WordPress automatically generates these relational links to the current
page.  However, BuddyPress doesn't adhere to these links.  In this
function, we remove these links when on a BuddyPress page.  This also
prevents additional, unnecessary queries from running.

since: 2.1.0

_bp_strip_spans_from_title( $title_part = '' )   X-Ref
Strip the span count of a menu item or of a title part.

return: string
param: string $title_part Title part to clean up.
since: 2.2.2

bp_core_get_minified_asset_suffix()   X-Ref
Get the correct filename suffix for minified assets.

return: string
since: 2.5.0

bp_core_get_components( $type = 'all' )   X-Ref
Return a list of component information.

return: array Requested components' data.
param: string $type Optional; component type to fetch. Default value is 'all', or 'optional', 'retired', 'required'.
since: 2.6.0

bp_nav_menu_get_loggedin_pages()   X-Ref
Create fake "post" objects for BP's logged-in nav menu for use in the WordPress "Menus" settings page.

WordPress nav menus work by representing post or tax term data as a custom
post type, which is then used to populate the checkboxes that appear on
Dashboard > Appearance > Menu as well as the menu as rendered on the front
end. Most of the items in the BuddyPress set of nav items are neither posts
nor tax terms, so we fake a post-like object so as to be compatible with the
menu.

This technique also allows us to generate links dynamically, so that, for
example, "My Profile" will always point to the URL of the profile of the
logged-in user.

return: mixed A URL or an array of dummy pages.
since: 1.9.0

bp_nav_menu_get_loggedout_pages()   X-Ref
Create fake "post" objects for BP's logged-out nav menu for use in the WordPress "Menus" settings page.

WordPress nav menus work by representing post or tax term data as a custom
post type, which is then used to populate the checkboxes that appear on
Dashboard > Appearance > Menu as well as the menu as rendered on the front
end. Most of the items in the BuddyPress set of nav items are neither posts
nor tax terms, so we fake a post-like object so as to be compatible with the
menu.

return: mixed A URL or an array of dummy pages.
since: 1.9.0

bp_nav_menu_get_item_url( $slug )   X-Ref
Get the URL for a BuddyPress WP nav menu item, based on slug.

BuddyPress-specific WP nav menu items have dynamically generated URLs,
based on the identity of the current user. This function lets you fetch the
proper URL for a given nav item slug (such as 'login' or 'messages').

return: string $nav_item_url The URL generated for the current user.
param: string $slug The slug of the nav item: login, register, or one of the
since: 1.9.0

bp_core_get_suggestions( $args )   X-Ref
BuddyPress Suggestions API for types of at-mentions.

This is used to power BuddyPress' at-mentions suggestions, but it is flexible enough to be used
for similar kinds of future requirements, or those implemented by third-party developers.

return: array|WP_Error Array of results. If there were any problems, returns a WP_Error object.
param: array $args Array of args for the suggestions.
since: 2.1.0

bp_ajax_get_suggestions()   X-Ref
AJAX endpoint for Suggestions API lookups.

since: 2.1.0
since: 4.0.0 Moved here to make sure this function is available

bp_upload_dir()   X-Ref
Set data from the BP root blog's upload directory.

Handy for multisite instances because all uploads are made on the BP root
blog and we need to query the BP root blog for the upload directory data.

This function ensures that we only need to use {@link switch_to_blog()}
once to get what we need.

return: bool|array
since: 2.3.0

bp_email_post_type()   X-Ref
Output the name of the email post type.

since: 2.5.0

bp_get_email_post_type()   X-Ref
Returns the name of the email post type.

return: string The name of the email post type.
since: 2.5.0

bp_get_email_post_type_labels()   X-Ref
Return labels used by the email post type.

return: array
since: 2.5.0

bp_get_email_post_type_supports()   X-Ref
Return array of features that the email post type supports.

return: array
since: 2.5.0

bp_get_taxonomy_common_args()   X-Ref
Returns the BP Taxonomy common arguments.

return: array The BP Taxonomy common arguments.
since: 7.0.0

bp_get_taxonomy_common_labels()   X-Ref
Returns the BP Taxonomy common labels.

return: array The BP Taxonomy common labels.
since: 7.0.0

bp_email_tax_type()   X-Ref
Output the name of the email type taxonomy.

since: 2.5.0

bp_get_email_tax_type()   X-Ref
Return the name of the email type taxonomy.

return: string The unique email taxonomy type ID.
since: 2.5.0

bp_get_email_tax_type_labels()   X-Ref
Return labels used by the email type taxonomy.

return: array
since: 2.5.0

bp_get_email_tax_type_args()   X-Ref
Return arguments used by the email type taxonomy.

return: array
since: 7.0.0

bp_get_type_metadata_schema( $suppress_filters = false, $type_taxonomy = '' )   X-Ref
Returns the default BuddyPress type metadata schema.

return: array                     The default BuddyPress type metadata schema.
param: boolean $suppress_filters Whether to suppress filters. Default `false`.
param: string  $type_taxonomy    Optional. the Type's taxonomy name.
since: 7.0.0

bp_register_type_meta( $type_tax, $meta_key, array $args )   X-Ref
Registers a meta key for BuddyPress types.

return: bool True if the meta key was successfully registered, false if not.
param: string $type_tax The BuddyPress type taxonomy.
param: string $meta_key The meta key to register.
param: array  $args     Data used to describe the meta key when registered. See
since: 7.0.0

bp_update_type_metadata( $type_id = 0, $taxonomy = '', $type_metas = array()   X-Ref
Update a list of metadata for a given type ID and a given taxonomy.

return: boolean             False on failure. True otherwise.
param: integer $type_id    The database ID of the BP Type.
param: string  $taxonomy   The BP Type taxonomy.
param: array   $type_metas An associative array (meta_key=>meta_value).
since: 7.0.0

bp_get_taxonomy_types( $taxonomy = '', $types = array()   X-Ref
Get types for a given BP Taxonomy.

return: array           The types of the given taxonomy.
param: string $taxonomy The taxonomy to transform terms in types for.
param: array  $types    Existing types to merge with the types found into the database.
since: 7.0.0

bp_get_email( $email_type )   X-Ref
Get an BP_Email object for the specified email type.

This function pre-populates the object with the subject, content, and template from the appropriate
email post type item. It does not replace placeholder tokens in the content with real values.

return: BP_Email|WP_Error BP_Email object, or WP_Error if there was a problem.
param: string $email_type Unique identifier for a particular type of email.
since: 2.5.0

bp_send_email( $email_type, $to, $args = array()   X-Ref
Send email, similar to WordPress' wp_mail().

A true return value does not automatically mean that the user received the
email successfully. It just only means that the method used was able to
process the request without any errors.

return: bool|WP_Error True if the email was sent successfully. Otherwise, a WP_Error object
param: string                   $email_type Type of email being sent.
param: string|array|int|WP_User $to         Either a email address, user ID, WP_User object,
param: array                    $args {
since: 2.5.0

bp_email_get_appearance_settings()   X-Ref
Return email appearance settings.

return: array
since: 2.5.0
since: 3.0.0 Added "direction" parameter for LTR/RTL email support, and

bp_email_get_template( WP_Post $object )   X-Ref
Get the paths to possible templates for the specified email object.

return: array
param: WP_Post $object Post to get email template for.
since: 2.5.0

bp_core_replace_tokens_in_text( $text, $tokens )   X-Ref
Replace all tokens in the input text with appropriate values.

Intended for use with the email system introduced in BuddyPress 2.5.0.

return: string
param: string $text   Text to replace tokens in.
param: array  $tokens Token names and replacement values for the $text.
since: 2.5.0

bp_email_get_schema()   X-Ref
Get a list of emails for populating the email post type.

return: array
since: 2.5.1
since: 10.0.0 Added members-membership-request and

bp_email_get_type_schema( $field = 'description' )   X-Ref
Get a list of emails for populating email type taxonomy terms.

return: array {
param: string $field Optional; defaults to "description" for backwards compatibility. Other values: "all".
since: 2.5.1
since: 2.7.0 $field argument added.

bp_email_unsubscribe_handler()   X-Ref
Handles unsubscribing user from notification emails.

since: 2.7.0

bp_email_get_unsubscribe_link( $args )   X-Ref
Creates unsubscribe link for notification emails.

return: string The unsubscribe link.
param: string $redirect_to The URL to which the unsubscribe query string is appended.
param: array $args {
since: 2.7.0

bp_email_get_salt()   X-Ref
Get a persistent salt for email unsubscribe links.

return: string|null Returns null if value isn't set, otherwise string.
since: 2.7.0

bp_email_get_unsubscribe_type_schema()   X-Ref
Get a list of emails for use in our unsubscribe functions.

return: array The array of email types and their schema.
since: 2.8.0

bp_email_get_type( $email = null )   X-Ref
Gets the BP Email type of a BP Email ID or object.

return: string The type of the BP Email object.
param: int|WP_Post $email Optional. BP Email ID or BP Email object. Defaults to global $post.
since: 8.0.0

bp_get_allowedtags()   X-Ref
Get BuddyPress content allowed tags.

return: array              BuddyPress content allowed tags.
since: 3.0.0

bp_strip_script_and_style_tags( $string )   X-Ref
Remove script and style tags from a string.

return: string         The stripped tags string.
param: string $string The string to strip tags from.
since: 3.0.1

bp_is_large_install()   X-Ref
Checks whether the current installation is "large".

By default, an installation counts as "large" if there are 10000 users or more.
Filter 'bp_is_large_install' to adjust.

return: bool
since: 4.1.0

bp_get_widget_max_count_limit( $widget_class = '' )   X-Ref
Returns the upper limit on the "max" item count, for widgets that support it.

return: int
param: string $widget_class Optional. Class name of the calling widget.
since: 5.0.0

bp_add_optout( $args = array()   X-Ref
Add a new BP_Optout.

return: false|int False on failure, ID of new (or existing) opt-out if successful.
param: array $args {
since: 8.0.0

bp_get_optouts( $args = array()   X-Ref
Find matching BP_Optouts.

return: array See {@link BP_Optout::get()}.
param: array $args See {@link BP_Optout::get()}.
since: 8.0.0

bp_user_has_opted_out( $email_address = '' )   X-Ref
Check an email address to see if that individual has opted out.

return: bool True if the user has opted out, false otherwise.
param: string $email_address Email address to check.
since: 8.0.0

bp_delete_optout_by_id( $id = 0 )   X-Ref
Delete a BP_Optout by ID.

return: bool True on success, false on failure.
param: int $id ID of the optout to delete.
since: 8.0.0



Generated: Thu Nov 21 01:00:57 2024 Cross-referenced by PHPXref 0.7.1