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-members/classes/class-bp-core-members-widget.php

    r10825 r11008  
    136136                            <div class="item-title fn"><a href="<?php bp_member_permalink(); ?>" title="<?php bp_member_name(); ?>"><?php bp_member_name(); ?></a></div>
    137137                            <div class="item-meta">
    138                                 <span class="activity"><?php
    139                                     if ( 'newest' === $settings['member_default'] ) :
    140                                         bp_member_registered();
    141                                     elseif ( 'active' === $settings['member_default'] ) :
    142                                         bp_member_last_active();
    143                                     elseif ( 'popular' === $settings['member_default'] ) :
    144                                         bp_member_total_friend_count();
    145                                     endif; ?></span>
     138                                <?php if ( 'newest' == $settings['member_default'] ) : ?>
     139                                    <span class="activity" data-livestamp="<?php bp_core_iso8601_date( bp_get_member_registered( array( 'relative' => false ) ) ); ?>"><?php bp_member_registered(); ?></span>
     140                                <?php elseif ( 'active' == $settings['member_default'] ) : ?>
     141                                    <span class="activity" data-livestamp="<?php bp_core_iso8601_date( bp_get_member_last_activity( array( 'relative' => false ) ) ); ?>"><?php bp_member_last_active(); ?></span>
     142                                <?php else : ?>
     143                                    <span class="activity"><?php bp_member_total_friend_count(); ?></span>
     144                                <?php endif; ?>
    146145                            </div>
    147146                        </div>
Note: See TracChangeset for help on using the changeset viewer.