Skip to:
Content

Opened 4 months ago

Closed 3 months 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
Cc:

Description

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 4 months ago.
7493-01.patch (2.3 KB) - added by hnla 3 months ago.
Reverse order of params to ensure any existing passed args aren't broken.

Download all attachments as: .zip

Change History (7)

@hnla
4 months ago

#1 @hnla
4 months ago

  • Keywords has-patch added; needs-patch removed

#2 @dcavins
4 months 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 )

And if a person needs to only pass the length, they can always pass:
$description = bp_get_group_description_excerpt( false, 128 )

and the function will get the right group to use.

Last edited 4 months ago by dcavins (previous) (diff)

#3 @hnla
4 months 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.


4 months ago

@hnla
3 months ago

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

#5 @hnla
3 months 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.