Skip to:
Content

BuddyPress.org

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#7213 closed defect (bug) (fixed)

Action "bp_notification_before_save" gets wrong argument

Reported by: wordpressrene's profile wordpressrene Owned by: djpaul's profile djpaul
Milestone: 2.7 Priority: normal
Severity: normal Version:
Component: Toolbar & Notifications Keywords:
Cc:

Description

The action "bp_notification_before_save" in the class "BP_Notifications_Notification" in the function "save()" pass the wrong parameter. The data of the notification ($this) is saved in the variable $data before the action. Then the action is called with the parameter $this. After that the notification is stored in the database with the values of $data. So you can't change the data before saving.

Attachments (1)

save notification.JPG (76.5 KB) - added by wordpressrene 8 years ago.

Download all attachments as: .zip

Change History (5)

#1 @wordpressrene
8 years ago

I forgot something: to fix this Bug, you just have to change array( &$this ) into array( &$data ) or alternativly you can move the action before the declaration of array( $data ).

Last edited 8 years ago by wordpressrene (previous) (diff)

#2 @DJPaul
8 years ago

  • Milestone changed from Awaiting Review to 2.7

Yes, good find. I'll move the declaration of $data because I think these filters are intended to filter the current object, not the data being saved.

#3 @djpaul
8 years ago

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

In 11015:

Notifications: fix bp_notification_before_save filter being called too late to allow changes to notification.

Fixes #7213

Props wordpressrene

#4 @DJPaul
8 years ago

Thank you also @wordpressrene for letting us know, I think this is your first BuddyPress contribution! :)

Note: See TracTickets for help on using tickets.