Skip to:

Opened 6 years ago

Last modified 4 years ago

#7126 reopened enhancement

[BP Nouveau Request] create functions to get the component's button args

Reported by: imath Owned by: imath
Milestone: Priority: normal
Severity: normal Version: 1.2
Component: Core Keywords:


Today the functions generating the buttons for loops or for the user profiles are doing something like this:

return bp_get_button( apply_filters( 'name_of_filter', $button_args ) );

So i have to do some funky stuff to only get the $button_args. Is there an objection if we create new functions to get these button args?

If function names are not great in the attach patch, we can change them to whatever you prefer.

Attachments (1)

7126.patch (32.3 KB) - added by imath 6 years ago.

Download all attachments as: .zip

Change History (12)

6 years ago

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

6 years ago

#2 @DJPaul
6 years ago

  • Component changed from Component - Any/All to Core

#3 @DJPaul
6 years ago

  • Milestone changed from Under Consideration to Awaiting Review

#4 @DJPaul
6 years ago

  • Milestone changed from Awaiting Review to 2.7

Sure, we do this for most of the other buttons, right? Makes sense to have the same implementation. (haven't looked at the patch, but I'm assuming you want to 2.7 this).

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

6 years ago

#6 @imath
6 years ago

  • Owner set to imath
  • Status changed from new to assigned

Yes :)

#7 @hnla
5 years ago

  • Keywords 2nd-opinion commit added

Run up against this working on the Nouveau button class and template tag updating to use the new button args for creating alternate button elements, wrappers and parent group elements: #7226

I'm patching my local for this 7126 patch so that I can check & configure our button function bp_nouveau_get_members_buttons()

Can we have 2nd pair of eyes on this patch ( imath had slight worry over function names ) to check over and commit - bear in mind as stated earlier this patch tends to bring the button into parity with others where we can get and set $button[] arg arrays and so is important in respect of simply unifying 'things'

#8 @r-a-y
5 years ago

@hnla - If you're using the patch in #7226, can't you use the fifth parameter of the filter?

$this->contents = apply_filters( 'bp_button_' . $this->component . '_' . $this->id, $this->contents, $this, $before, $after, $r );

The $r parameter should include all button arguments.

The dynamic naming of the filter (from when this was first implemented) might be problematic. If this is the case, let me know.

Last edited 5 years ago by r-a-y (previous) (diff)

#9 @hnla
5 years ago

@r-a-y thanks for looking.

tbh at this stage not 100% sure what specifically is an issue and would have to deconstruct further the current nouveau button functions, in reality I have ability to manipulate the button in question without seeming issue, sort of assumed the patch was required but it was built / required before we updated BP's button class, so guess the review really is whether the patch now is redundant or not!

#10 @r-a-y
5 years ago

  • Keywords 2nd-opinion commit removed
  • Milestone 2.7 deleted
  • Status changed from assigned to closed

I'm going to close this in favor for #7226 and based on what I mentioned in comment:8.

However, let me know if anything else is needed for buttons to work for the better in BP Nouveau!

#11 @hnla
4 years ago

  • Status changed from closed to reopened

Re-opening this ticket.
The issue remains valid .
if we look at the bp-friends template tag & functions changes in patch what we're attempting to do is separate the $args required for the friends buttons from the bp_get_button() return in bp_get_add_friend_button().

In Nouveau the buttons are built by fetching those args but this has the unintended effect of running bp_get_button() not desired! so Nouveau hacks a solution adding an empty array filtered to bp_get_add_friend_button runs the function then unsets the filter, a tad ugly? Another consequence, maybe an edge case however... run the Nouveau files as a standalone theme or site and the late priority set on the filters fails and we get a duplicate button generated.

It seems to make sense to have the friend button args and switch as a separate function as the patch demonstrates, it's certainly more flexible than as currently setup!

Note: See TracTickets for help on using tickets.