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
840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 | 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.