[buddypress-trac] [BuddyPress Trac] #8003: Setting Reply-To and From causes excessive database overhead in cases where addresses don't match a user

buddypress-trac noreply at wordpress.org
Fri Nov 23 12:20:05 UTC 2018


#8003: Setting Reply-To and From causes excessive database overhead in cases where
addresses don't match a user
------------------------------------+----------------------------------
 Reporter:  boonebgorges            |       Owner:  DJPaul
     Type:  enhancement             |      Status:  new
 Priority:  normal                  |   Milestone:  Under Consideration
Component:  Emails                  |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |
------------------------------------+----------------------------------

Comment (by DJPaul):

 Good spot with this!

 >  it looks like the primary purpose for this class in the case of
 *recipients* is to validate email addresses and to get canonical display
 names for the "To" field.

 Yep.

 > I'm happy to work up a patch, but was hoping first to get some
 architectural feedback from @djpaul.

 I think the better solution is to convert `BP_Email_Recipient` to an
 interface, and create classes to represent those likely to have a
 WordPress user account, and those not, like you suggest.

 I don't like the idea of adding a filter or optional function parameter to
 control the behaviour because it goes against the email API design's
 intentions.

 If @boonebgorges you want a fix for 4.0 but don't have time or desire to
 do the full interface rewrite, I think in `set_replyto()` etc that  if we
 pass null to the `BP_Email_Recipient` constructor for `$email_or_user`,
 `$this->address` will be empty, which should avoid the
 `get_user_by('email')` lookup in the `get_user()` method. We can then
 manually set the class' `address` and `name` properties manually.

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/8003#comment:2>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list