-
diff --git src/bp-blogs/bp-blogs-template.php src/bp-blogs/bp-blogs-template.php
index cc119d4e9..ac4dd83a7 100644
|
|
function bp_blog_last_active( $args = array() ) { |
638 | 638 | // Backwards compatibility for anyone forcing a 'true' active_format. |
639 | 639 | if ( true === $r['active_format'] ) { |
640 | 640 | /* translators: %s: human time diff of the last time the site was active. */ |
641 | | $r['active_format'] = _x( 'active %s', 'last time the site was active', 'buddypress' ); |
| 641 | $r['active_format'] = _x( 'Active %s', 'last time the site was active', 'buddypress' ); |
642 | 642 | } |
643 | 643 | |
644 | 644 | // Blog has been posted to at least once. |
-
diff --git src/bp-core/bp-core-functions.php src/bp-core/bp-core-functions.php
index 0e2fe7c96..4b2341013 100644
|
|
add_action( 'wp_head', 'bp_core_record_activity' ); |
1575 | 1575 | * @since 1.0.0 |
1576 | 1576 | * |
1577 | 1577 | * @param int|string $last_activity_date The date of last activity. |
1578 | | * @param string $string A sprintf()-able statement of the form 'active %s'. |
| 1578 | * @param string $string A sprintf()-able statement of the form 'Active %s'. |
1579 | 1579 | * @return string $last_active A string of the form '3 years ago'. |
1580 | 1580 | */ |
1581 | 1581 | function bp_core_get_last_activity( $last_activity_date = '', $string = '' ) { |
… |
… |
function bp_core_get_last_activity( $last_activity_date = '', $string = '' ) { |
1597 | 1597 | * |
1598 | 1598 | * @param string $last_active Last activity string based on time since date given. |
1599 | 1599 | * @param string $last_activity_date The date of last activity. |
1600 | | * @param string $string A sprintf()-able statement of the form 'active %s'. |
| 1600 | * @param string $string A sprintf()-able statement of the form 'Active %s'. |
1601 | 1601 | */ |
1602 | 1602 | return apply_filters( 'bp_core_get_last_activity', $last_active, $last_activity_date, $string ); |
1603 | 1603 | } |
-
diff --git src/bp-core/classes/class-bp-core-user.php src/bp-core/classes/class-bp-core-user.php
index 51d5dd862..ce4a6d128 100644
|
|
class BP_Core_User { |
205 | 205 | ); |
206 | 206 | |
207 | 207 | /* translators: %s: human time diff of the last time the user was active on the site. */ |
208 | | $this->last_active = bp_core_get_last_activity( bp_get_user_last_activity( $this->id ), _x( 'active %s', 'last time the user was active', 'buddypress' ) ); |
| 208 | $this->last_active = bp_core_get_last_activity( bp_get_user_last_activity( $this->id ), _x( 'Active %s', 'last time the user was active', 'buddypress' ) ); |
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
-
diff --git src/bp-groups/bp-groups-blocks.php src/bp-groups/bp-groups-blocks.php
index 97f455a3c..063868ee5 100644
|
|
function bp_groups_render_groups_block( $attributes = array() ) { |
303 | 303 | $output .= sprintf( |
304 | 304 | '<time datetime="%1$s">%2$s</time>', |
305 | 305 | esc_attr( bp_core_get_iso8601_date( $group->last_activity ) ), |
306 | | /* translators: %s: a human time diff. */ |
| 306 | /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */ |
307 | 307 | sprintf( esc_html__( 'Active %s', 'buddypress' ), bp_get_group_last_active( $group ) ) |
308 | 308 | ); |
309 | 309 | } elseif ( 'popular' === $block_args['extraInfo'] ) { |
-
diff --git src/bp-groups/bp-groups-widgets.php src/bp-groups/bp-groups-widgets.php
index 333398f52..937bb14cb 100644
|
|
function groups_ajax_widget_groups_list() { |
76 | 76 | <?php else : ?> |
77 | 77 | <span class="activity" data-livestamp="<?php bp_core_iso8601_date( bp_get_group_last_active( 0, array( 'relative' => false ) ) ); ?>"> |
78 | 78 | <?php |
79 | | /* translators: %s: last activity timestamp (e.g. "active 1 hour ago") */ |
80 | | printf( _x( 'active %s', 'last time the group was active', 'buddypress' ), bp_get_group_last_active() ); |
| 79 | /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */ |
| 80 | printf( _x( 'Active %s', 'last time the group was active', 'buddypress' ), bp_get_group_last_active() ); |
81 | 81 | ?> |
82 | 82 | </span> |
83 | 83 | <?php endif; ?> |
-
diff --git src/bp-groups/classes/class-bp-groups-invite-template.php src/bp-groups/classes/class-bp-groups-invite-template.php
index dc36224cc..c0d9050d6 100644
|
|
class BP_Groups_Invite_Template { |
275 | 275 | $this->invite->user->user_url = bp_core_get_user_domain( $user_id, $this->invite->user->user_nicename, $this->invite->user->user_login ); |
276 | 276 | $this->invite->user->user_link = "<a href='{$this->invite->user->user_url}'>{$this->invite->user->fullname}</a>"; |
277 | 277 | |
278 | | /* translators: %s: last activity timestamp (e.g. "active 1 hour ago") */ |
279 | | $this->invite->user->last_active = bp_core_get_last_activity( $this->invite->user->last_activity, __( 'active %s', 'buddypress' ) ); |
| 278 | /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */ |
| 279 | $this->invite->user->last_active = bp_core_get_last_activity( $this->invite->user->last_activity, __( 'Active %s', 'buddypress' ) ); |
280 | 280 | |
281 | 281 | if ( bp_is_active( 'groups' ) ) { |
282 | 282 | $total_groups = BP_Groups_Member::total_group_count( $user_id ); |
-
diff --git src/bp-groups/classes/class-bp-groups-widget.php src/bp-groups/classes/class-bp-groups-widget.php
index 90862063a..08eadf14e 100644
|
|
class BP_Groups_Widget extends WP_Widget { |
149 | 149 | } elseif ( 'popular' == $instance['group_default'] ) { |
150 | 150 | bp_group_member_count(); |
151 | 151 | } else { |
152 | | /* translators: %s: last activity timestamp (e.g. "active 1 hour ago") */ |
153 | | printf( __( 'active %s', 'buddypress' ), bp_get_group_last_active() ); |
| 152 | /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */ |
| 153 | printf( __( 'Active %s', 'buddypress' ), bp_get_group_last_active() ); |
154 | 154 | } |
155 | 155 | ?> |
156 | 156 | </span> |
-
diff --git src/bp-members/bp-members-blocks.php src/bp-members/bp-members-blocks.php
index c9944bc32..11886548b 100644
|
|
function bp_members_render_members_block( $attributes = array() ) { |
332 | 332 | $output .= sprintf( |
333 | 333 | '<time datetime="%1$s">%2$s</time>', |
334 | 334 | esc_attr( bp_core_get_iso8601_date( $member->last_activity ) ), |
335 | | /* translators: %s: a human time diff. */ |
| 335 | /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */ |
336 | 336 | sprintf( esc_html__( 'Active %s', 'buddypress' ), bp_core_time_since( $member->last_activity ) ) |
337 | 337 | ); |
338 | 338 | } |
-
diff --git src/bp-members/bp-members-template.php src/bp-members/bp-members-template.php
index e202ea11b..70e73b779 100644
|
|
function bp_member_last_active( $args = array() ) { |
955 | 955 | |
956 | 956 | // Backwards compatibility for anyone forcing a 'true' active_format. |
957 | 957 | if ( true === $r['active_format'] ) { |
958 | | $r['active_format'] = __( 'active %s', 'buddypress' ); |
| 958 | /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */ |
| 959 | $r['active_format'] = __( 'Active %s', 'buddypress' ); |
959 | 960 | } |
960 | 961 | |
961 | 962 | // Member has logged in at least one time. |
… |
… |
function bp_last_activity( $user_id = 0 ) { |
1686 | 1687 | */ |
1687 | 1688 | function bp_get_last_activity( $user_id = 0 ) { |
1688 | 1689 | |
1689 | | if ( empty( $user_id ) ) |
| 1690 | if ( empty( $user_id ) ) { |
1690 | 1691 | $user_id = bp_displayed_user_id(); |
| 1692 | } |
1691 | 1693 | |
1692 | | $last_activity = bp_core_get_last_activity( bp_get_user_last_activity( $user_id ), __('active %s', 'buddypress') ); |
| 1694 | /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */ |
| 1695 | $last_activity = bp_core_get_last_activity( bp_get_user_last_activity( $user_id ), __('Active %s', 'buddypress') ); |
1693 | 1696 | |
1694 | 1697 | /** |
1695 | 1698 | * Filters the 'active [x days ago]' string for a user. |
-
diff --git src/bp-templates/bp-legacy/buddypress/groups/groups-loop.php src/bp-templates/bp-legacy/buddypress/groups/groups-loop.php
index b52165e8a..38e82510d 100644
|
|
do_action( 'bp_before_groups_loop' ); ?> |
64 | 64 | |
65 | 65 | <div class="item"> |
66 | 66 | <div class="item-title"><?php bp_group_link(); ?></div> |
67 | | <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> |
| 67 | <div class="item-meta"> |
| 68 | <span class="activity" data-livestamp="<?php bp_core_iso8601_date( bp_get_group_last_active( 0, array( 'relative' => false ) ) ); ?>"> |
| 69 | <?php |
| 70 | /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */ |
| 71 | printf( __( 'Active %s', 'buddypress' ), bp_get_group_last_active() ); |
| 72 | ?> |
| 73 | </span> |
| 74 | </div> |
68 | 75 | |
69 | 76 | <div class="item-desc"><?php bp_group_description_excerpt(); ?></div> |
70 | 77 | |
-
diff --git src/bp-templates/bp-legacy/buddypress/groups/single/cover-image-header.php src/bp-templates/bp-legacy/buddypress/groups/single/cover-image-header.php
index 34f5c361b..5409895eb 100644
|
|
do_action( 'bp_before_group_header' ); ?> |
60 | 60 | do_action( 'bp_group_header_meta' ); ?> |
61 | 61 | |
62 | 62 | <span class="highlight"><?php bp_group_type(); ?></span> |
63 | | <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> |
| 63 | <span class="activity" data-livestamp="<?php bp_core_iso8601_date( bp_get_group_last_active( 0, array( 'relative' => false ) ) ); ?>"> |
| 64 | <?php |
| 65 | /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */ |
| 66 | printf( __( 'Active %s', 'buddypress' ), bp_get_group_last_active() ); |
| 67 | ?> |
| 68 | </span> |
64 | 69 | |
65 | 70 | <?php bp_group_description(); ?> |
66 | 71 | |
-
diff --git src/bp-templates/bp-legacy/buddypress/groups/single/group-header.php src/bp-templates/bp-legacy/buddypress/groups/single/group-header.php
index 409e5d13b..b08ea5716 100644
|
|
do_action( 'bp_before_group_header' ); |
69 | 69 | |
70 | 70 | <div id="item-header-content"> |
71 | 71 | <span class="highlight"><?php bp_group_type(); ?></span> |
72 | | <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 | <span class="activity" data-livestamp="<?php bp_core_iso8601_date( bp_get_group_last_active( 0, array( 'relative' => false ) ) ); ?>"> |
| 73 | <?php |
| 74 | /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */ |
| 75 | printf( __( 'Active %s', 'buddypress' ), bp_get_group_last_active() ); |
| 76 | ?> |
| 77 | </span> |
73 | 78 | |
74 | 79 | <?php |
75 | 80 | |
-
diff --git src/bp-templates/bp-nouveau/buddypress/groups/groups-loop.php src/bp-templates/bp-nouveau/buddypress/groups/groups-loop.php
index c0c7eb975..c523ad189 100644
|
|
bp_nouveau_before_loop(); ?> |
44 | 44 | <p class="last-activity item-meta"> |
45 | 45 | <?php |
46 | 46 | printf( |
47 | | /* translators: %s: last activity timestamp (e.g. "active 1 hour ago") */ |
| 47 | /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */ |
48 | 48 | esc_html__( 'Active %s', 'buddypress' ), |
49 | 49 | sprintf( |
50 | 50 | '<span data-livestamp="%1$s">%2$s</span>', |
-
diff --git src/bp-templates/bp-nouveau/buddypress/groups/single/cover-image-header.php src/bp-templates/bp-nouveau/buddypress/groups/single/cover-image-header.php
index 356ae26e9..07439f2f8 100644
|
|
|
31 | 31 | <p class="activity"> |
32 | 32 | <?php |
33 | 33 | printf( |
34 | | /* translators: %s: last activity timestamp (e.g. "active 1 hour ago") */ |
| 34 | /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */ |
35 | 35 | esc_html__( 'Active %s', 'buddypress' ), |
36 | 36 | sprintf( |
37 | 37 | '<span data-livestamp="%1$s">%2$s</span>', |
-
diff --git src/bp-templates/bp-nouveau/buddypress/groups/single/group-header.php src/bp-templates/bp-nouveau/buddypress/groups/single/group-header.php
index 11ff03a5a..92c18c48d 100644
|
|
|
28 | 28 | <p class="activity"> |
29 | 29 | <?php |
30 | 30 | printf( |
31 | | /* translators: %s: last activity timestamp (e.g. "active 1 hour ago") */ |
| 31 | /* translators: %s: last activity timestamp (e.g. "Active 1 hour ago") */ |
32 | 32 | esc_html__( 'Active %s', 'buddypress' ), |
33 | 33 | sprintf( |
34 | 34 | '<span data-livestamp="%1$s">%2$s</span>', |
-
diff --git tests/phpunit/testcases/blogs/template.php tests/phpunit/testcases/blogs/template.php
index db0dc0f85..e7fe54147 100644
|
|
class BP_Tests_Blogs_Template extends BP_UnitTestCase { |
16 | 16 | $blogs_template->blog = new stdClass; |
17 | 17 | $blogs_template->blog->last_activity = $time; |
18 | 18 | |
19 | | $this->assertEquals( bp_core_get_last_activity( $time, __( 'active %s', 'buddypress' ) ), bp_get_blog_last_active() ); |
| 19 | $this->assertEquals( bp_core_get_last_activity( $time, __( 'Active %s', 'buddypress' ) ), bp_get_blog_last_active() ); |
20 | 20 | |
21 | 21 | $blogs_template->blog = null; |
22 | 22 | } |
… |
… |
class BP_Tests_Blogs_Template extends BP_UnitTestCase { |
33 | 33 | $blogs_template->blog = new stdClass; |
34 | 34 | $blogs_template->blog->last_activity = $time; |
35 | 35 | |
36 | | $this->assertEquals( bp_core_get_last_activity( $time, __( 'active %s', 'buddypress' ) ), bp_get_blog_last_active( array( 'active_format' => true, ) ) ); |
| 36 | $this->assertEquals( bp_core_get_last_activity( $time, __( 'Active %s', 'buddypress' ) ), bp_get_blog_last_active( array( 'active_format' => true, ) ) ); |
37 | 37 | |
38 | 38 | $blogs_template->blog = null; |
39 | 39 | } |
-
diff --git tests/phpunit/testcases/members/template.php tests/phpunit/testcases/members/template.php
index 88e1614ea..1a7d7e16d 100644
|
|
class BP_Tests_Members_Template extends BP_UnitTestCase { |
234 | 234 | $members_template->member = new stdClass; |
235 | 235 | $members_template->member->last_activity = $time; |
236 | 236 | |
237 | | $this->assertEquals( bp_core_get_last_activity( $time, __( 'active %s', 'buddypress' ) ), bp_get_member_last_active() ); |
| 237 | $this->assertEquals( bp_core_get_last_activity( $time, __( 'Active %s', 'buddypress' ) ), bp_get_member_last_active() ); |
238 | 238 | } |
239 | 239 | |
240 | 240 | /** |
… |
… |
class BP_Tests_Members_Template extends BP_UnitTestCase { |
249 | 249 | $members_template->member = new stdClass; |
250 | 250 | $members_template->member->last_activity = $time; |
251 | 251 | |
252 | | $this->assertEquals( bp_core_get_last_activity( $time, __( 'active %s', 'buddypress' ) ), bp_get_member_last_active( array( 'active_format' => true, ) ) ); |
| 252 | $this->assertEquals( bp_core_get_last_activity( $time, __( 'Active %s', 'buddypress' ) ), bp_get_member_last_active( array( 'active_format' => true, ) ) ); |
253 | 253 | } |
254 | 254 | |
255 | 255 | /** |