Skip to:
Content

BuddyPress.org

Changeset 11008


Ignore:
Timestamp:
08/10/2016 12:55:49 PM (10 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

Location:
trunk/src
Files:
2 added
17 edited

Legend:

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

    r10958 r11008  
    208208
    209209        $activity_allowedtags = $allowedtags;
    210         $activity_allowedtags['a']['class']    = array();
    211         $activity_allowedtags['a']['id']       = array();
    212         $activity_allowedtags['a']['rel']      = array();
    213         $activity_allowedtags['a']['title']    = array();
    214         $activity_allowedtags['b']             = array();
    215         $activity_allowedtags['code']          = array();
    216         $activity_allowedtags['i']             = array();
     210        $activity_allowedtags['a']['class'] = array();
     211        $activity_allowedtags['a']['id']    = array();
     212        $activity_allowedtags['a']['rel']   = array();
     213        $activity_allowedtags['a']['title'] = array();
     214
     215        $activity_allowedtags['b']    = array();
     216        $activity_allowedtags['code'] = array();
     217        $activity_allowedtags['i']    = array();
     218
    217219        $activity_allowedtags['img']           = array();
    218220        $activity_allowedtags['img']['src']    = array();
    … …  
    223225        $activity_allowedtags['img']['id']     = array();
    224226        $activity_allowedtags['img']['title']  = array();
    225         $activity_allowedtags['span']          = array();
    226         $activity_allowedtags['span']['class'] = array();
     227
     228        $activity_allowedtags['span']                   = array();
     229        $activity_allowedtags['span']['class']          = array();
     230        $activity_allowedtags['span']['data-livestamp'] = array();
    227231
    228232
  • 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        ) );
  • trunk/src/bp-core/bp-core-cssjs.php

    r10899 r11008  
    4848                'bp-cover-image' => array( 'file' => "{$url}cover-image{$min}.js", 'dependencies' => array(), 'footer' => true ),
    4949
     50                // Version 2.7.
     51                'bp-moment'    => array( 'file' => "{$url}moment{$min}.js", 'dependencies' => array(), 'footer' => true ),
     52                'bp-livestamp' => array( 'file' => "{$url}livestamp{$min}.js", 'dependencies' => array( 'jquery', 'bp-moment' ), 'footer' => true ),
    5053        ) );
    5154
    … …  
    461464}
    462465add_action( 'bp_enqueue_scripts', 'bp_add_cover_image_inline_css', 11 );
     466
     467/**
     468 * Enqueues livestamp.js on BuddyPress pages.
     469 *
     470 * @since 2.7.0
     471 */
     472function bp_core_add_livestamp() {
     473        if ( ! is_buddypress() ) {
     474                return;
     475        }
     476
     477        bp_core_enqueue_livestamp();
     478}
     479add_action( 'bp_enqueue_scripts', 'bp_core_add_livestamp' );
     480
     481/**
     482 * Enqueue and localize livestamp.js script.
     483 *
     484 * @since 2.7.0
     485 */
     486function bp_core_enqueue_livestamp() {
     487        // If bp-livestamp isn't enqueued, do it now.
     488        if ( wp_script_is( 'bp-livestamp' ) ) {
     489                return;
     490        }
     491
     492        wp_enqueue_script( 'bp-livestamp' );
     493
     494        // We're only localizing the relative time strings for moment.js since that's all we need for now.
     495        wp_localize_script( 'bp-livestamp', 'BP_Moment_i18n', array(
     496                'future' => __( 'in %s',         'buddypress' ),
     497                'past'   => __( '%s ago',        'buddypress' ),
     498                's'      => __( 'a few seconds', 'buddypress' ),
     499                'm'      => __( 'a minute',      'buddypress' ),
     500                'mm'     => __( '%d minutes',    'buddypress' ),
     501                'h'      => __( 'an hour',       'buddypress' ),
     502                'hh'     => __( '%d hours',      'buddypress' ),
     503                'd'      => __( 'a day',         'buddypress' ),
     504                'dd'     => __( '%d days',       'buddypress' ),
     505                'M'      => __( 'a month',       'buddypress' ),
     506                'MM'     => __( '%d months',     'buddypress' ),
     507                'y'      => __( 'a year',        'buddypress' ),
     508                'yy'     => __( '%d years',      'buddypress' ),
     509        ) );
     510
     511        if ( function_exists( 'wp_add_inline_script' ) ) {
     512                wp_add_inline_script ( 'bp-livestamp', bp_core_moment_js_config() );
     513        } else {
     514                add_action( 'wp_footer', '_bp_core_moment_js_config_footer', 20 );
     515        }
     516}
     517
     518/**
     519 * Return moment.js config.
     520 *
     521 * @since 2.7.0
     522 *
     523 * @return string
     524 */
     525function bp_core_moment_js_config() {
     526        $inline_js = <<<EOD
     527jQuery(function() {
     528        moment.locale( 'bp', {
     529                relativeTime : BP_Moment_i18n
     530        });
     531});
     532EOD;
     533
     534        return $inline_js;
     535}
     536
     537/**
     538 * Print moment.js config in page footer.
     539 *
     540 * Will be removed once we set our minimum version of WP 4.5.
     541 *
     542 * @since 2.7.0
     543 *
     544 * @access private
     545 */
     546function _bp_core_moment_js_config_footer() {
     547        if ( ! wp_script_is( 'bp-livestamp' ) ) {
     548                return;
     549        }
     550
     551        printf( '<script>%s</script>', bp_core_moment_js_config() );
     552}
  • trunk/src/bp-core/bp-core-functions.php

    r10972 r11008  
    12591259}
    12601260
     1261/**
     1262 * Output an ISO-8601 date from a date string.
     1263 *
     1264 * @since 2.7.0
     1265 *
     1266 * @param string String of date to convert. Timezone should be UTC before using this.
     1267 * @return string
     1268 */
     1269 function bp_core_iso8601_date( $timestamp = '' ) {
     1270        echo bp_core_get_iso8601_date( $timestamp );
     1271}
     1272        /**
     1273         * Return an ISO-8601 date from a date string.
     1274         *
     1275         * @since 2.7.0
     1276         *
     1277         * @param string String of date to convert. Timezone should be UTC before using this.
     1278         * @return string
     1279         */
     1280         function bp_core_get_iso8601_date( $timestamp = '' ) {
     1281                if ( ! $timestamp ) {
     1282                        return '';
     1283                }
     1284
     1285                $date = new DateTime( $timestamp, new DateTimeZone( 'UTC' ) );
     1286                return $date->format( DateTime::ISO8601 );
     1287        }
     1288
    12611289/** Messages ******************************************************************/
    12621290
  • trunk/src/bp-core/classes/class-bp-admin.php

    r10953 r11008  
    869869                                <a href="https://bbpress.org">bbPress</a>,
    870870                                <a href="https://github.com/ichord/Caret.js">Caret.js</a>,
    871                                 <a href="http://tedgoas.github.io/Cerberus/">Cerberus</a>,
    872                                 <a href="http://ionicons.com/">Ionicons</a>,
     871                                <a href="https://tedgoas.github.io/Cerberus/">Cerberus</a>,
     872                                <a href="https://ionicons.com/">Ionicons</a>,
    873873                                <a href="https://github.com/carhartl/jquery-cookie">jquery.cookie</a>,
     874                                <a href="https://mattbradley.github.io/livestampjs/">Livestamp.js</a>,
    874875                                <a href="https://www.mediawiki.org/wiki/MediaWiki">MediaWiki</a>,
     876                                <a href="http://momentjs.com/">Moment.js</a>,
    875877                                <a href="https://wordpress.org">WordPress</a>.
    876878                        </p>
  • trunk/src/bp-friends/bp-friends-widgets.php

    r10652 r11008  
    7979                                        <div class="item-title fn"><a href="<?php bp_member_permalink(); ?>" title="<?php bp_member_name(); ?>"><?php bp_member_name(); ?></a></div>
    8080                                        <?php if ( 'active' == $type ) : ?>
    81                                                 <div class="item-meta"><span class="activity"><?php bp_member_last_active(); ?></span></div>
     81                                                <div class="item-meta"><span class="activity" data-livestamp="<?php bp_core_iso8601_date( bp_get_member_last_active( array( 'relative' => false ) ) ); ?>"><?php bp_member_last_active(); ?></span></div>
    8282                                        <?php elseif ( 'newest' == $type ) : ?>
    83                                                 <div class="item-meta"><span class="activity"><?php bp_member_registered(); ?></span></div>
     83                                                <div class="item-meta"><span class="activity" data-livestamp="<?php bp_core_iso8601_date( bp_get_member_registered( array( 'relative' => false ) ) ); ?>"><?php bp_member_registered(); ?></span></div>
    8484                                        <?php elseif ( bp_is_active( 'friends' ) ) : ?>
    8585                                                <div class="item-meta"><span class="activity"><?php bp_member_total_friend_count(); ?></span></div>
  • trunk/src/bp-friends/classes/class-bp-core-friends-widget.php

    r10809 r11008  
    118118                                                        <div class="item-title fn"><a href="<?php bp_member_permalink(); ?>" title="<?php bp_member_name(); ?>"><?php bp_member_name(); ?></a></div>
    119119                                                        <div class="item-meta">
    120                                                                 <span class="activity">
    121                                                                 <?php
    122                                                                         if ( 'newest' == $instance['friend_default'] )
    123                                                                                 bp_member_registered();
    124                                                                         if ( 'active' == $instance['friend_default'] )
    125                                                                                 bp_member_last_active();
    126                                                                         if ( 'popular' == $instance['friend_default'] )
    127                                                                                 bp_member_total_friend_count();
    128                                                                 ?>
    129                                                                 </span>
     120                                                                <?php if ( 'newest' == $instance['friend_default'] ) : ?>
     121                                                                        <span class="activity" data-livestamp="<?php bp_core_iso8601_date( bp_get_member_registered( array( 'relative' => false ) ) ); ?>"><?php bp_member_registered(); ?></span>
     122                                                                <?php elseif ( 'active' == $instance['friend_default'] ) : ?>
     123                                                                        <span class="activity" data-livestamp="<?php bp_core_iso8601_date( bp_get_member_last_activity( array( 'relative' => false ) ) ); ?>"><?php bp_member_last_active(); ?></span>
     124                                                                <?php else : ?>
     125                                                                        <span class="activity"><?php bp_member_total_friend_count(); ?></span>
     126                                                                <?php endif; ?>
    130127                                                        </div>
    131128                                                </div>
  • trunk/src/bp-groups/bp-groups-template.php

    r10904 r11008  
    685685 *
    686686 * @since 1.0.0
    687  *
    688  * @param object|bool $group Optional. Group object.
    689  *                           Default: current group in loop.
    690  */
    691 function bp_group_last_active( $group = false ) {
    692         echo bp_get_group_last_active( $group );
     687 * @since 2.7.0 Added $args as a parameter.
     688 *
     689 * @param object|bool  $group Optional. Group object. Default: current group in loop.
     690 * @param array|string $args Optional. {@see bp_get_group_last_active()}.
     691 */
     692function bp_group_last_active( $group = false, $args = array() ) {
     693        echo bp_get_group_last_active( $group, $args );
    693694}
    694695        /**
    … …  
    696697         *
    697698         * @since 1.0.0
    698          *
    699          * @param object|bool $group Optional. Group object.
    700          *                           Default: current group in loop.
     699         * @since 2.7.0 Added $args as a parameter.
     700         *
     701         * @param object|bool  $group Optional. Group object. Default: current group in loop.
     702         * @param array|string $args {
     703         *     Array of optional parameters.
     704         *
     705         *     @type bool $relative Optional. If true, returns relative activity date. eg. active 5 months ago.
     706         *                          If false, returns active date value from database. Default: true.
     707         * }
    701708         * @return string
    702709         */
    703         function bp_get_group_last_active( $group = false ) {
     710        function bp_get_group_last_active( $group = false, $args = array() ) {
    704711                global $groups_template;
    705712
    … …  
    708715                }
    709716
     717                $r = wp_parse_args( $args, array(
     718                        'relative' => true,
     719                ) );
     720
    710721                $last_active = $group->last_activity;
    711 
    712                 if ( !$last_active ) {
     722                if ( ! $last_active ) {
    713723                        $last_active = groups_get_groupmeta( $group->id, 'last_activity' );
     724                }
     725
     726                // We do not want relative time, so return now.
     727                // @todo Should the 'bp_get_group_last_active' filter be applied here?
     728                if ( ! $r['relative'] ) {
     729                        return esc_attr( $last_active );
    714730                }
    715731
    … …  
    719735
    720736                        /**
    721                          * Filters the 'last active' string for the current gorup in the loop.
     737                         * Filters the 'last active' string for the current group in the loop.
    722738                         *
    723739                         * @since 1.0.0
    … …  
    10531069 *
    10541070 * @since 1.0.0
    1055  *
    1056  * @param object|bool $group Optional. Group object.
    1057  *                           Default: current group in loop.
    1058  */
    1059 function bp_group_date_created( $group = false ) {
    1060         echo bp_get_group_date_created( $group );
     1071 * @since 2.7.0 Added $args as a parameter.
     1072 *
     1073 * @param object|bool  $group Optional. Group object. Default: current group in loop.
     1074 * @param array|string $args  {@see bp_get_group_date_created()}.
     1075 */
     1076function bp_group_date_created( $group = false, $args = array() ) {
     1077        echo bp_get_group_date_created( $group, $args );
    10611078}
    10621079        /**
    … …  
    10641081         *
    10651082         * @since 1.0.0
    1066          *
    1067          * @param object|bool $group Optional. Group object.
    1068          *                           Default: current group in loop.
     1083         * @since 2.7.0 Added $args as a parameter.
     1084         *
     1085         * @param object|bool  $group Optional. Group object. Default: current group in loop.
     1086         * @param array|string $args {
     1087         *     Array of optional parameters.
     1088         *
     1089         *     @type bool $relative Optional. If true, returns relative created date. eg. active 5 months ago.
     1090         *                          If false, returns created date value from database. Default: true.
     1091         * }
    10691092         * @return string
    10701093         */
    1071         function bp_get_group_date_created( $group = false ) {
     1094        function bp_get_group_date_created( $group = false, $args = array() ) {
    10721095                global $groups_template;
     1096
     1097                $r = wp_parse_args( $args, array(
     1098                        'relative' => true,
     1099                ) );
    10731100
    10741101                if ( empty( $group ) ) {
    10751102                        $group =& $groups_template->group;
     1103                }
     1104
     1105                // We do not want relative time, so return now.
     1106                // @todo Should the 'bp_get_group_date_created' filter be applied here?
     1107                if ( ! $r['relative'] ) {
     1108                        return esc_attr( $group->date_created );
    10761109                }
    10771110
    … …  
    39714004
    39724005/**
    3973  * @since 1.0.0
    3974  */
    3975 function bp_group_member_joined_since() {
    3976         echo bp_get_group_member_joined_since();
    3977 }
    3978 
    3979         /**
     4006 * Output the joined date for the current member in the group member loop.
     4007 *
     4008 * @since 1.0.0
     4009 * @since 2.7.0 Added $args as a parameter.
     4010 *
     4011 * @param array|string $args {@see bp_get_group_member_joined_since()}
     4012 * @return string
     4013 */
     4014function bp_group_member_joined_since( $args = array() ) {
     4015        echo bp_get_group_member_joined_since( $args );
     4016}
     4017        /**
     4018         * Return the joined date for the current member in the group member loop.
     4019         *
    39804020         * @since 1.0.0
    3981          *
    3982          * @return mixed|void
    3983          */
    3984         function bp_get_group_member_joined_since() {
     4021         * @since 2.7.0 Added $args as a parameter.
     4022         *
     4023         * @param array|string $args {
     4024         *     Array of optional parameters.
     4025         *
     4026         *     @type bool $relative Optional. If true, returns relative joined date. eg. joined 5 months ago.
     4027         *                          If false, returns joined date value from database. Default: true.
     4028         * }
     4029         * @return string
     4030         */
     4031        function bp_get_group_member_joined_since( $args = array() ) {
    39854032                global $members_template;
     4033
     4034                $r = wp_parse_args( $args, array(
     4035                        'relative' => true,
     4036                ) );
     4037
     4038                // We do not want relative time, so return now.
     4039                // @todo Should the 'bp_get_group_member_joined_since' filter be applied here?
     4040                if ( ! $r['relative'] ) {
     4041                        return esc_attr( $members_template->member->date_modified );
     4042                }
    39864043
    39874044                /**
  • trunk/src/bp-groups/bp-groups-widgets.php

    r10652 r11008  
    6666                                        <div class="item-title"><a href="<?php bp_group_permalink() ?>" title="<?php bp_group_name() ?>"><?php bp_group_name() ?></a></div>
    6767                                        <div class="item-meta">
    68                                                 <span class="activity">
    69                                                         <?php
    70                                                         if ( 'newest-groups' == $_POST['filter'] ) {
    71                                                                 printf( __( 'created %s', 'buddypress' ), bp_get_group_date_created() );
    72                                                         } elseif ( 'recently-active-groups' == $_POST['filter'] ) {
    73                                                                 printf( __( 'active %s', 'buddypress' ), bp_get_group_last_active() );
    74                                                         } elseif ( 'popular-groups' == $_POST['filter'] ) {
    75                                                                 bp_group_member_count();
    76                                                         }
    77                                                         ?>
    78                                                 </span>
     68                                                <?php if ( 'newest-groups' === $_POST['filter'] ) : ?>
     69                                                        <span class="activity" data-livestamp="<?php bp_core_iso8601_date( bp_get_group_date_created( 0, array( 'relative' => false ) ) ); ?>"><?php printf( __( 'created %s', 'buddypress' ), bp_get_group_date_created() ); ?></span>
     70                                                <?php elseif ( 'recently-active-groups' === $_POST['filter'] ) : ?>
     71                                                        <span class="activity" data-livestamp="<?php bp_core_iso8601_date( bp_get_group_last_active( 0, array( 'relative' => false ) ) ); ?>"><?php printf( __( 'active %s', 'buddypress' ), bp_get_group_last_active() ); ?></span>
     72                                                <?php else : ?>
     73                                                        <span class="activity"><?php bp_group_member_count(); ?></span>
     74                                                <?php endif; ?>
    7975                                        </div>
    8076                                </div>
  • trunk/src/bp-members/bp-members-template.php

    r10825 r11008  
    934934 * @since 1.2.0
    935935 *
    936  * @param array $args See {@link bp_get_member_last_active()}.
     936 * @param array $args {@see bp_get_member_last_active()}.
    937937 */
    938938function bp_member_last_active( $args = array() ) {
    … …  
    943943         *
    944944         * @since 1.2.0
     945         * @since 2.7.0 Added 'relative' as a parameter to $args.
    945946         *
    946947         * @param array $args {
    947948         *     Array of optional arguments.
    948          *     @type mixed $active_format If true, formatted "active 5 minutes
    949          *                                ago". If false, formatted "5 minutes ago".
    950          *                                If string, should be sprintf'able like
    951          *                                'last seen %s ago'.
     949         *     @type mixed $active_format If true, formatted "active 5 minutes ago". If false, formatted "5 minutes
     950         *                                ago". If string, should be sprintf'able like 'last seen %s ago'.
     951         *     @type bool  $relative      If true, will return relative time "5 minutes ago". If false, will return
     952         *                                date from database. Default: true.
    952953         * }
    953954         * @return string
    … …  
    958959                // Parse the activity format.
    959960                $r = bp_parse_args( $args, array(
    960                         'active_format' => true
     961                        'active_format' => true,
     962                        'relative'      => true,
    961963                ) );
    962964
    … …  
    968970                // Member has logged in at least one time.
    969971                if ( isset( $members_template->member->last_activity ) ) {
     972                        // We do not want relative time, so return now.
     973                        // @todo Should the 'bp_member_last_active' filter be applied here?
     974                        if ( ! $r['relative'] ) {
     975                                return esc_attr( $members_template->member->last_activity );
     976                        }
    970977
    971978                        // Backwards compatibility for pre 1.5 'ago' strings.
    … …  
    974981                                : bp_core_time_since( $members_template->member->last_activity );
    975982
    976                         // Member has never logged in or been active.
     983                // Member has never logged in or been active.
    977984                } else {
    978985                        $last_activity = __( 'Never active', 'buddypress' );
    … …  
    11521159 *
    11531160 * @since 1.2.0
    1154  */
    1155 function bp_member_registered() {
    1156         echo bp_get_member_registered();
     1161 * @since 2.7.0 Added $args as a parameter.
     1162 *
     1163 * @param array $args Optional. {@see bp_get_member_registered()}
     1164 */
     1165function bp_member_registered( $args = array() ) {
     1166        echo bp_get_member_registered( $args );
    11571167}
    11581168        /**
    … …  
    11601170         *
    11611171         * @since 1.2.0
    1162          *
    1163          * @return string
    1164          */
    1165         function bp_get_member_registered() {
     1172         * @since 2.7.0 Added $args as a parameter.
     1173         *
     1174         * @param array $args {
     1175         *     Array of optional parameters.
     1176         *
     1177         *     @type bool $relative Optional. If true, returns relative registered date. eg. registered 5 months ago.
     1178         *                          If false, returns registered date value from database.
     1179         * }
     1180         *
     1181         * @return string
     1182         */
     1183        function bp_get_member_registered( $args = array() ) {
    11661184                global $members_template;
     1185
     1186                $r = wp_parse_args( $args, array(
     1187                        'relative' => true,
     1188                ) );
     1189
     1190                // We do not want relative time, so return now.
     1191                // @todo Should the 'bp_member_registered' filter be applied here?
     1192                if ( ! $r['relative'] ) {
     1193                        return esc_attr( $members_template->member->user_registered );
     1194                }
    11671195
    11681196                $registered = esc_attr( bp_core_get_last_activity( $members_template->member->user_registered, _x( 'registered %s', 'Records the timestamp that the user registered into the activity stream', 'buddypress' ) ) );
  • 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>
  • trunk/src/bp-templates/bp-legacy/buddypress/activity/comment.php

    r10150 r11008  
    2626        <div class="acomment-meta">
    2727                <?php
    28                 /* translators: 1: user profile link, 2: user name, 3: activity permalink, 4: activity timestamp */
    29                 printf( __( '<a href="%1$s">%2$s</a> replied <a href="%3$s" class="activity-time-since"><span class="time-since">%4$s</span></a>', 'buddypress' ), bp_get_activity_comment_user_link(), bp_get_activity_comment_name(), bp_get_activity_comment_permalink(), bp_get_activity_comment_date_recorded() );
     28                /* translators: 1: user profile link, 2: user name, 3: activity permalink, 4: ISO8601 timestamp, 5: activity relative timestamp */
     29                printf( __( '<a href="%1$s">%2$s</a> replied <a href="%3$s" class="activity-time-since"><span class="time-since" data-livestamp="%4$s">%5$s</span></a>', 'buddypress' ), bp_get_activity_comment_user_link(), bp_get_activity_comment_name(), bp_get_activity_comment_permalink(), bp_core_get_iso8601_date( bp_get_activity_comment_date_recorded() ), bp_get_activity_comment_date_recorded() );
    3030                ?>
    3131        </div>
  • trunk/src/bp-templates/bp-legacy/buddypress/groups/groups-loop.php

    r10181 r11008  
    6060                        <div class="item">
    6161                                <div class="item-title"><a href="<?php bp_group_permalink(); ?>"><?php bp_group_name(); ?></a></div>
    62                                 <div class="item-meta"><span class="activity"><?php printf( __( 'active %s', 'buddypress' ), bp_get_group_last_active() ); ?></span></div>
     62                                <div class="item-meta"><span class="activity" data-livestamp="<?php bp_core_iso8601_date( bp_get_group_last_active( 0, array( 'relative' => false ) ) ); ?>"><?php printf( __( 'active %s', 'buddypress' ), bp_get_group_last_active() ); ?></span></div>
    6363
    6464                                <div class="item-desc"><?php bp_group_description_excerpt(); ?></div>
  • trunk/src/bp-templates/bp-legacy/buddypress/groups/single/cover-image-header.php

    r10967 r11008  
    6060
    6161                                <span class="highlight"><?php bp_group_type(); ?></span>
    62                                 <span class="activity"><?php printf( __( 'active %s', 'buddypress' ), bp_get_group_last_active() ); ?></span>
     62                                <span class="activity" data-livestamp="<?php bp_core_iso8601_date( bp_get_group_last_active( 0, array( 'relative' => false ) ) ); ?>"><?php printf( __( 'active %s', 'buddypress' ), bp_get_group_last_active() ); ?></span>
    6363
    6464                                <?php bp_group_description(); ?>
  • trunk/src/bp-templates/bp-legacy/buddypress/groups/single/group-header.php

    r10967 r11008  
    6969<div id="item-header-content">
    7070        <span class="highlight"><?php bp_group_type(); ?></span>
    71         <span class="activity"><?php printf( __( 'active %s', 'buddypress' ), bp_get_group_last_active() ); ?></span>
     71        <span class="activity" data-livestamp="<?php bp_core_iso8601_date( bp_get_group_last_active( 0, array( 'relative' => false ) ) ); ?>"><?php printf( __( 'active %s', 'buddypress' ), bp_get_group_last_active() ); ?></span>
    7272
    7373        <?php
  • trunk/src/bp-templates/bp-legacy/buddypress/groups/single/members.php

    r10181 r11008  
    5757
    5858                                <h5><?php bp_group_member_link(); ?></h5>
    59                                 <span class="activity"><?php bp_group_member_joined_since(); ?></span>
     59                                <span class="activity" data-livestamp="<?php bp_core_iso8601_date( bp_get_group_member_joined_since( array( 'relative' => false ) ) ); ?>"><?php bp_group_member_joined_since(); ?></span>
    6060
    6161                                <?php
  • trunk/src/bp-templates/bp-legacy/buddypress/members/members-loop.php

    r10150 r11008  
    6868                                </div>
    6969
    70                                 <div class="item-meta"><span class="activity"><?php bp_member_last_active(); ?></span></div>
     70                                <div class="item-meta"><span class="activity" data-livestamp="<?php bp_core_iso8601_date( bp_get_member_last_active( array( 'relative' => false ) ) ); ?>"><?php bp_member_last_active(); ?></span></div>
    7171
    7272                                <?php
Note: See TracChangeset for help on using the changeset viewer.