bp_notifications_get_registered_components()
Return an array of component names that are currently active and have registered Notifications callbacks.
Description
See also
Return
(array) $component_names Array of registered components.
Source
File: bp-notifications/bp-notifications-functions.php
function bp_notifications_get_registered_components() {
// Load BuddyPress.
$bp = buddypress();
// Setup return value.
$component_names = array();
// Get the active components.
$active_components = array_keys( $bp->active_components );
// Loop through components, look for callbacks, add to return value.
foreach ( $active_components as $component ) {
if ( !empty( $bp->$component->notification_callback ) ) {
$component_names[] = $component;
}
// The extended profile component is identified in the active_components array as 'xprofile'.
// However, the extended profile child object has the key 'profile' in the $bp object.
if ( 'xprofile' == $component && ! empty( $bp->profile->notification_callback ) ) {
$component_names[] = $component;
}
}
/**
* Filters active components with registered notifications callbacks.
*
* @since BuddyPress 1.9.1
*
* @param array $component_names Array of registered component names.
* @param array $active_components Array of active components.
*/
return apply_filters( 'bp_notifications_get_registered_components', $component_names, $active_components );
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 1.9.1 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.