#7321 closed enhancement (fixed)
Make hard-coded activity excerpt length a filterable function
| Reported by: | slaFFik | Owned by: | boonebgorges |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.8 |
| Component: | Activity | Version: | |
| Severity: | normal | 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
@
10 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.
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Good idea.