Skip to:
Content

BuddyPress.org

Opened 8 years ago

Closed 2 years ago

Last modified 22 months ago

#7126 closed enhancement (fixed)

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

Reported by: imath's profile imath Owned by: imath's profile imath
Milestone: 11.0.0 Priority: normal
Severity: normal Version: 1.2
Component: Templates Keywords:
Cc:

Description

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 8 years ago.

Download all attachments as: .zip

Change History (20)

@imath
8 years ago

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


8 years ago

#2 @DJPaul
8 years ago

  • Component changed from Component - Any/All to Core

#3 @DJPaul
8 years ago

  • Milestone changed from Under Consideration to Awaiting Review

#4 @DJPaul
8 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.


8 years ago

#6 @imath
8 years ago

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

Yes :)

#7 @hnla
8 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
8 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 8 years ago by r-a-y (previous) (diff)

#9 @hnla
8 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
8 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
7 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!

#12 @imath
2 years ago

  • Component changed from Core to Templates
  • Milestone set to 11.0.0

As @hnla explained, looking at it again now I'm working on a renewed Nouveau template (See #8722), it doesn't make sense to use filters and globals to only get these buttons arguments. Let's have direct functions to get these!

#13 @imath
2 years ago

In 13299:

Introduce a function to only get the Public Message button arguments

BP Nouveau is doing a complex workaround to only get these arguments without generating the BP_Button HTML output. bp_activity_get_public_message_button_args() eases the process of getting these arguments and removes the need for such a workaround.

Props hnla

See #7126
See #8722

#14 @imath
2 years ago

In 13300:

Introduce a function to only get the Private Message button arguments

bp_get_send_message_button_args() eases the process of getting these arguments and removes the need for BP Nouveau's workaround.

Props hnla

See #7126
See #8722

#15 @imath
2 years ago

In 13301:

Introduce a function to only get the Friendship button arguments

bp_get_add_friend_button_args() eases the process of getting these arguments and removes the need for BP Nouveau's workaround.
Deprecate the bp_nouveau_members_catch_button_args() as no more needed.

Props hnla

See #7126
See #8722

#16 @imath
2 years ago

In 13302:

Introduce a function to only get the "Join/Leave Group" button args

bp_groups_get_group_join_button_args() eases the process of getting these arguments and removes the need for BP Nouveau's workaround.
Deprecate the bp_nouveau_groups_catch_button_args() as no more needed.

Props hnla

See #7126
See #8722

#17 @imath
2 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 13303:

Introduce a function to only get the "Visit blog" button args

bp_get_blogs_visit_blog_button_args() eases the process of getting these arguments and removes the need for BP Nouveau's workaround.
Deprecate the bp_nouveau_blogs_catch_button_args() as no more needed.

Props hnla

Fixes #7126
See #8722

#18 @imath
22 months ago

In 13409:

Prevent a Members single view header action button filters wrong use

Some custom code/plugins might wrongly use something else than an array
(eg: false) to disable one of the action buttons shown inside the single
Members view header. Changes made during the 11.0.0 release revealed this
potential issue.

See #7126
See #8800 (Trunk)

#19 @imath
22 months ago

In 13410:

Prevent a Members single view header action button filters wrong use

Some custom code/plugins might wrongly use something else than an array
(eg: false) to disable one of the action buttons shown inside the single
Members view header. Changes made during the 11.0.0 release revealed this
potential issue.

See #7126
Closes https://github.com/buddypress/buddypress/pull/59
Fixes #8800 (branch 11.0)

Note: See TracTickets for help on using tickets.