Skip to:
Content

BuddyPress.org

Opened 7 years ago

Closed 7 years ago

#4536 closed enhancement (fixed)

Bug in bp_get_send_message_button()

Reported by: megainfo Owned by: MegaInfo
Milestone: 1.8 Priority: low
Severity: minor Version: 1.6.1
Component: Messages Keywords:
Cc: megainfodz@…

Description

I was try to add filter to bp_get_send_message_button function

i get error

Fatal error: Cannot use assign-op operators with overloaded objects nor string offsets in C:\[My wp dev dir]\wp-content\themes\buddypow\includes\bp\bp-theme.php on line 937

i see the code of bp_get_send_message_button function

the filter is applied after getting the html of button.

i was attached a suggestive patch.

Attachments (1)

patch.txt (732 bytes) - added by megainfo 7 years ago.
correction of bp_get_send_message_button function

Download all attachments as: .zip

Change History (6)

@megainfo
7 years ago

correction of bp_get_send_message_button function

#1 follow-up: @johnjamesjacoby
7 years ago

  • Milestone changed from Awaiting Review to 1.7
  • Priority changed from normal to low
  • Severity changed from major to minor
  • Type changed from defect (bug) to enhancement

Attached patch changes the way this function works. While I'm not opposed to the idea (I actually like it better) we can't change the way this works for others that are using it this way.

Basically it comes down to your filter is doing it wrong. If you want to use this filter and manipulate the output of the button, you'll need to use some regex, or create your own new function and button.

#2 @johnjamesjacoby
7 years ago

  • Milestone changed from 1.7 to 1.8

Punting to 1.8.

#3 in reply to: ↑ 1 @rogercoathup
7 years ago

Replying to johnjamesjacoby:

Attached patch changes the way this function works. While I'm not opposed to the idea (I actually like it better) we can't change the way this works for others that are using it this way.

Basically it comes down to your filter is doing it wrong. If you want to use this filter and manipulate the output of the button, you'll need to use some regex, or create your own new function and button.

I raised this in another trac ticket -- I think it's the code for bp_get_send_message_button that's wrong -- it's done differently to other buttons, and the filter can't work: http://buddypress.trac.wordpress.org/ticket/4650

#4 @boonebgorges
7 years ago

rogercoathup is correct that every other button filter in BP filters the args rather than the HTML.

I'd be surprised if anyone out there is using the filter as it stands, because it'd be such a PITA to use. However, I don't want to break anyone's site or plugin, so I'm going to add a separate filter and leave an inline comment telling devs not to use the existing one.

#5 @boonebgorges
7 years ago

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

In 6943:

Introduces bp_get_send_message_button_args filter

Most buttons have a filter on the args that are passed to bp_has_button().
The bp-messages Send Message button filter 'bp_get_send_message_button', in
contrast, is on the HTML return value of bp_has_button(). This was probably
a mistake in the original implementation. However, simply moving the existing
filter would break compatibility with existing implementations that use it. So
we've added a new filter, which works the same as other button filters, but has
a slightly different naming convention.

Fixes #4536

Props megainfo, rogercoathup

Note: See TracTickets for help on using tickets.