#7321 closed enhancement (fixed)
Make hard-coded activity excerpt length a filterable function
Reported by: | slaFFik | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 2.8 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Activity | Keywords: | good-first-bug has-patch |
Cc: |
Description
Currently there are 2 places:
// bp-activity/bp-activity-filters.php $excerpt_length = apply_filters( 'bp_activity_excerpt_length', 358 ); // bp-activity/bp-activity-template.php $latest_update = apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], 358 ) ) ), $user_id );
I propose to create bp_activity_get_excerpt_length()
, with bp_activity_excerpt_length
filter in it.
function bp_activity_get_excerpt_length() { return apply_filters( 'bp_activity_excerpt_length', 358 ); }
And the 1st usage will be changed to a direct function usage without filters, and the second to this:
$latest_update = apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], bp_activity_get_excerpt_length() ) ) ), $user_id );
Attachments (1)
Change History (9)
#4
@
8 years ago
Hi @sanket.parmar
Thanks for the patch, we'll look at it as soon as we can.
Just a tip - when you add a patch onto a ticket, please leave a comment, too. Most people don't receive a email notification about a change on a Trac ticket, unless a comment is also left.
#5
@
8 years ago
@sanket.parmar Thanks for the excellent patch! The one change I'll make is this: the @since
version on the filter documentation shouldn't change to 2.8.0, since it's the same filter name as we introduced in 1.5.0.
Good idea.