Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/16/2012 03:50:18 PM (12 years ago)
Author:
boonebgorges
Message:

Add pre- and post-filters to bp_core_time_since()

Fixes #2782

Props aesqe

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-functions.php

    r6310 r6338  
    375375 *
    376376 * @package BuddyPress Core
     377 * @uses apply_filters() Filter 'bp_core_time_since_pre' to bypass BP's calculations
     378 * @uses apply_filters() Filter 'bp_core_time_since' to modify BP's calculations
    377379 * @param $older_date int Unix timestamp of date you want to calculate the time since for
    378380 * @param $newer_date int Unix timestamp of date to compare older date to. Default false (current time).
     
    380382 */
    381383function bp_core_time_since( $older_date, $newer_date = false ) {
     384
     385    // Use this filter to bypass BuddyPress's time_since calculations
     386    if ( $pre_value = apply_filters( 'bp_core_time_since_pre', false, $older_date, $newer_date ) ) {
     387        return $pre_value;
     388    }
    382389
    383390    // Setup the strings
     
    469476    }
    470477
    471     return $output;
     478    return apply_filters( 'bp_core_time_since', $output, $older_date, $newer_date );
    472479}
    473480
Note: See TracChangeset for help on using the changeset viewer.