[buddypress-trac] [BuddyPress Trac] #7321: Make hard-coded activity excerpt length a filterable function

buddypress-trac noreply at wordpress.org
Thu Nov 3 22:02:23 UTC 2016


#7321: Make hard-coded activity excerpt length a filterable function
--------------------------+----------------------------
 Reporter:  slaFFik       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  2.8
Component:  Activity      |    Version:
 Severity:  normal        |   Keywords:  good-first-bug
--------------------------+----------------------------
 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
 );
 }}}

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7321>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list