Skip to:

Opened 5 years ago

Closed 5 years ago

#7493 closed enhancement (fixed)

Update bp_group_description_excerpt() to accept a $length param

Reported by: hnla Owned by: hnla
Milestone: 2.9 Priority: normal
Severity: normal Version:
Component: Groups Keywords: has-patch


In our group loop template we display bp_group_description_excerpt() this function in bp-members-template.php L:1179 accepts one param $group and passes off to the get function which calls bp_create_excerpt($group->description).

bp_create_excerpt() takes a $length value though which we can't take advantage of.

Proposed update will add a $length param to the group descr functions.

I would prefer to change the params to an array to better match other similar functions and prevent the nuisance of passing only one var needing to be the first ordered, but worry that might be a breaking change for existing templates that might be passing params?

Attachments (2)

7493.patch (2.3 KB) - added by hnla 5 years ago.
7493-01.patch (2.3 KB) - added by hnla 5 years ago.
Reverse order of params to ensure any existing passed args aren't broken.

Download all attachments as: .zip

Change History (7)

5 years ago

#1 @hnla
5 years ago

  • Keywords has-patch added; needs-patch removed

#2 @dcavins
5 years ago

I think this is a good idea, but we should leave the group parameter as the first parameter and add the optional length parameter in the second position. Then the basic-use function signature won't change and we'll minimize backward compatibility problems. Like:

bp_get_group_description_excerpt( $group = false, $length = false )

Version 0, edited 5 years ago by dcavins (next)

#3 @hnla
5 years ago

It's having to pass the first value even though we don't want or need to that bothers me when passing vars this way but take the point about the ordering I'll revise, thanks for the feedback.

This ticket was mentioned in Slack in #buddypress by hnla. View the logs.

5 years ago

5 years ago

Reverse order of params to ensure any existing passed args aren't broken.

#5 @hnla
5 years ago

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

In 11531:

Update bp_group_description_excerpt() to take a $length param

bp_create_excerpt() excepts a $length param however the group desc excerpt function does not pass this param only $group.

Commit adds the $length param to function, ensuring passed order is preserved (this param will be used in Nouveau for group grid layouts).

Fixes #7493
Props hnla, dcavins

Note: See TracTickets for help on using tickets.