Skip to:
Content

BuddyPress.org

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#6969 closed defect (bug) (fixed)

BP Emails - friendship accepted email is not sent

Reported by: shanebp's profile shanebp Owned by: r-a-y's profile r-a-y
Milestone: 2.5.2 Priority: normal
Severity: normal Version: 2.5.0
Component: Emails Keywords: has-patch commit
Cc: s

Description

Reports of friendship accepted emails not being sent.

https://buddypress.org/support/topic/do-not-send-one-email-in-buddypress-2-5/

Confirmed by me in BP 2.5.1

The 'friendship requested' email is sent.

Attachments (2)

6969.01.patch (1.3 KB) - added by r-a-y 8 years ago.
6969.02.patch (1.2 KB) - added by r-a-y 8 years ago.

Download all attachments as: .zip

Change History (10)

#1 @r-a-y
8 years ago

  • Milestone changed from Awaiting Review to 2.5.2
  • Owner set to r-a-y
  • Status changed from new to reviewing

#2 @r-a-y
8 years ago

  • Keywords has-patch added
  • Status changed from reviewing to accepted
  • Version set to 2.5.0

Confirmed.

Bug occurs when a numeric string is passed to BP_Email_Recipient instead of an integer.

The $initiator_id in friends_notification_accepted_request() uses a numeric string, which is why the email fails to send because no recipient is parsed correctly in BP_Email_Recipient.

I suggest patching BP_Email_Recipient to use is_numeric() instead of is_int() to fix this problem. A broader solution would be to audit all our access methods and functions to ensure that numeric strings are cast as integers or to use is_numeric() where needed.

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

@r-a-y
8 years ago

#3 @DJPaul
8 years ago

I would prefer we typecast the numeric string to an int when we pass it to bp_send_email() -- the email classes themselves are pretty typestrict by design/intention.

#4 @r-a-y
8 years ago

I would prefer we typecast the numeric string to an int

I guess we go the broad route then! Check out 02.patch.

@r-a-y
8 years ago

#5 @DJPaul
8 years ago

  • Keywords commit added

@r-a-y I was more referring to changing the token value in friends_notification_accepted_request() rather than changing it upstream, but I don't care particularly where it's done. Thanks for looking into this!

#6 @r-a-y
8 years ago

Let's do your fix for 2.5.2 and mine for 2.6.0 since my approach is more of a drastic change.

Will commit this later today.

#7 @r-a-y
8 years ago

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

In 10683:

Friends: Fix issue with friendship accepted email not being sent.

Previously, the $initiator_id variable in friends_notification_accepted_request()`
was a numeric string. The BP_Email_Recipient class can only handle
strict integers, which prevented friendship accepted emails from being
sent.

For 2.5-branch, this commit casts $initiator_id variable as an integer
to fix the immediate problem. A broader solution to audit all our access
methods and functions to ensure that numeric strings are cast as
integers will be implemented in a future release.

Fixes #6969 (2.5-branch).

#8 @r-a-y
8 years ago

For 2.6.0, I've created a new ticket for my changes - #6977.

Note: See TracTickets for help on using tickets.