Skip to:

Opened 3 years ago

Closed 3 years ago

#8498 closed enhancement (fixed)

Suggestion for unsettling some attributes in BP_Button instead of all other places

Reported by: sbrajesh's profile sbrajesh Owned by: imath's profile imath
Milestone: 9.0.0 Priority: low
Severity: normal Version: 2.7
Component: Core Keywords: has-patch


At the moment, while adding a button code, we are using various conditions to detect if the button element is 'button' then we set 'data-bp-nonce' in 'button_attr' array otherwise we set the href attribute.

Instead of setting it conditionally at the time we are registering the buttons(It is being repeated at many places), a better solution will be add both of these attribute while registering button and then checking if the button element is 'button' and reset the 'href' in the BP_Button class.

That will save too many conditions for core as well as 3rd party developers. The 'data-bp-nonce' is a harmless attribute for anchor element, so no need to do anything about that.

I am proposing a patch for it, Please let me know if it is feasible to have it in the core.

Attachments (1)

8498.diff (626 bytes) - added by sbrajesh 3 years ago.

Download all attachments as: .zip

Change History (4)

3 years ago

#1 @imath
3 years ago

  • Milestone changed from Awaiting Review to 9.0.0
  • Version changed from 8.0.0 to 2.7

Thanks for your suggestion and patch. I need to dive deeply in it but it looks very interesting & promising.

#2 @sbrajesh
3 years ago

Thank you for looking into it.

#3 @imath
3 years ago

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

In 13014:

Ensure the href attribute is not wrongly used inside button elements

Props sbrajesh

Fixes #8498

Note: See TracTickets for help on using tickets.