Making WordPress.org

Opened 5 years ago

Closed 5 years ago

#5121 closed defect (bug) (fixed)

Fix support forum dates title and datetime attributes

Reported by: tweetythierry's profile TweetyThierry Owned by: dd32's profile dd32
Milestone: Priority: normal
Component: Support Forums Keywords: needs-patch
Cc:

Description

The title attributes for dates (example: 1 day, 2 hours ago) on the support forum are set using the post title instead of the created date (title should be in date format, not time ago). This would be specifically useful when hovering over the "time ago" date to see the actual date.

Additionally these HTML should contain datetime attribute too.

Change History (2)

#1 @TweetyThierry
5 years ago

I believe this is the template line https://meta.trac.wordpress.org/browser/sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-forums/bbpress/loop-single-reply.php#L39 which needs to be updated.

Since to my knowledge there isn't a core bbPress function to get the last reply date, we may have to add a helper function, something similar to bbp_get_topic_last_active_time() but returning the date or timestamp. For example:

function bb_base_get_topic_last_active_timestamp( $topic_id = 0 ) {
	$topic_id = bbp_get_topic_id( $topic_id );

	// Try to get the most accurate freshness time possible.
	$last_active = get_post_meta( $topic_id, '_bbp_last_active_time', true );

	if ( empty( $last_active ) ) {
		$reply_id = bbp_get_topic_last_reply_id( $topic_id );

		if ( ! empty( $reply_id ) ) {
			return get_post_field( 'post_date', $reply_id );
		} else {
			return get_post_field( 'post_date', $topic_id );
		}
	}
}
Version 0, edited 5 years ago by TweetyThierry (next)

#2 @dd32
5 years ago

  • Owner set to dd32
  • Resolution set to fixed
  • Status changed from new to closed

In 9848:

Support Forums: Use the actual date as the title text for date links.

Fixes #5121.

Note: See TracTickets for help on using tickets.