Skip to:

Opened 8 years ago

Closed 7 years ago

#2782 closed enhancement (fixed)

Add filters to bp_core_time_since

Reported by: aesqe Owned by:
Milestone: 1.7 Priority: normal
Severity: normal Version: 1.5
Component: Core Keywords: has-patch dev-feedback
Cc: aesqe@…


add a filter right at the beginning of bp_core_time_since function so it can be overridden by a custom one, or wrap it in function_exists.

something like this

$filter = apply_filters('bp_core_time_since', '', $older_date, $newer_date);
if( '' != $filter )
	return $filter;

thanks :)

Attachments (1)

bp-core-functions-1531-patch.diff (1.0 KB) - added by aesqe 7 years ago.

Download all attachments as: .zip

Change History (6)

#1 @DJPaul
8 years ago

I'm concerned by the lack of proper i18n support in this function for the order of the number and name. Is this a case of adding dummy gettext calls so the appropriate strings are generated in the pot file?

#3056 is slightly related.

#2 @DJPaul
8 years ago

  • Keywords needs-patch added; time removed
  • Milestone changed from Awaiting Review to Future Release
  • Summary changed from bp_core_time_since override to Add filters to bp_core_time_since

#3 @aesqe
7 years ago

  • Keywords has-patch dev-feedback added; needs-patch removed
  • Severity set to normal

The patch adds two filters:

"bp_core_time_since_pre" and "bp_core_time_since_post"

One is for overriding the whole function, the other for filtering the final output of the function.

I'd really appreciate if this could be included in the next version, as I have my own time_since function which I use. Also, in Croatian, plural of numbered nouns can have more than one variant.

Thanks :)

#4 @DJPaul
7 years ago

  • Milestone changed from Future Release to 1.7

Any objections to adding filters like these? Not sure why we haven't touched the patch in the last 7 months :/

#5 @boonebgorges
7 years ago

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

(In [6338]) Add pre- and post-filters to bp_core_time_since()

Fixes #2782

Props aesqe

Note: See TracTickets for help on using tickets.