Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/10/2016 12:55:49 PM (4 years ago)
Author:
djpaul
Message:

Fix inaccurate timestamps caused by page caching.

If any template with a timestamp is statically cached, then the timestamps quickly become inaccurate.
The change adds livestamp.js and moment.js to dynamically update timestamps with the real relative time.

A consequence is that the labels surrounding the timestamps, notably in our widgets, have slightly changed.
We're going to keep an eye on this for the remainder of the 2.7 development cycle, and may make further adjustments as testing proves necessary.

Fixes #5757

Props r-a-y, imath, DJPaul

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-template.php

    r10904 r11008  
    14771477    $date_recorded  = bp_core_time_since( $activities_template->activity->date_recorded );
    14781478
     1479    // Set up 'time-since' <span>.
     1480    $time_since = sprintf(
     1481        '<span class="time-since" data-livestamp="%1$s">%2$s</span>',
     1482        bp_core_get_iso8601_date( $activities_template->activity->date_recorded ),
     1483        $date_recorded
     1484    );
     1485
    14791486    /**
    14801487     * Filters the activity item time since markup.
     
    14851492     */
    14861493    $time_since = apply_filters_ref_array( 'bp_activity_time_since', array(
    1487         '<span class="time-since">' . $date_recorded . '</span>',
     1494        $time_since,
    14881495        &$activities_template->activity
    14891496    ) );
Note: See TracChangeset for help on using the changeset viewer.