bp_activity_heartbeat_strings( array $strings = array() )
Set the strings for WP HeartBeat API where needed.
Description
Parameters
- $strings
-
(Optional) Localized strings.
Default value: array()
Return
(array) $strings
Source
File: bp-activity/bp-activity-filters.php
function bp_activity_heartbeat_strings( $strings = array() ) { if ( ! bp_activity_do_heartbeat() ) { return $strings; } $global_pulse = 0; /** * Filter that checks whether the global heartbeat settings already exist. * * @since BuddyPress 2.0.0 * * @param array $value Heartbeat settings array. */ $heartbeat_settings = apply_filters( 'heartbeat_settings', array() ); if ( ! empty( $heartbeat_settings['interval'] ) ) { // 'Fast' is 5 $global_pulse = is_numeric( $heartbeat_settings['interval'] ) ? absint( $heartbeat_settings['interval'] ) : 5; } /** * Filters the pulse frequency to be used for the BuddyBoss Activity heartbeat. * * @since BuddyPress 2.0.0 * * @param int $value The frequency in seconds between pulses. */ $bp_activity_pulse = apply_filters( 'bp_activity_heartbeat_pulse', 15 ); /** * Use the global pulse value unless: * a. the BP-specific value has been specifically filtered, or * b. it doesn't exist (ie, BP will be the only one using the heartbeat, * so we're responsible for enabling it) */ if ( has_filter( 'bp_activity_heartbeat_pulse' ) || empty( $global_pulse ) ) { $pulse = $bp_activity_pulse; } else { $pulse = $global_pulse; } $strings = array_merge( $strings, array( 'newest' => __( 'Load Newest', 'buddyboss' ), 'pulse' => absint( $pulse ), ) ); return $strings; }
Changelog
Version | Description |
---|---|
BuddyPress 2.0.0 | 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.