[buddypress-trac] [BuddyPress Trac] #7996: bp_email_set_default_tokens() (or some part of email sending) should switch to root blog
    buddypress-trac 
    noreply at wordpress.org
       
    Sun Nov  4 14:53:58 UTC 2018
    
    
  
#7996: bp_email_set_default_tokens() (or some part of email sending) should switch
to root blog
--------------------------+---------------------
 Reporter:  boonebgorges  |       Owner:  DJPaul
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  4.0
Component:  Emails        |     Version:
 Severity:  major         |  Resolution:
 Keywords:                |
--------------------------+---------------------
Comment (by DJPaul):
 > linked to a plugin that hooks to get_post_metadata() but gets an ID for
 a post on the root blog, which it can never find, so it ends up running
 thousands of database queries.
 This sounds like a bug in that plugin, if it's making thousands of
 database queries from one call to `bp_send_email`. :)
 > Strategy 1 is architecturally the nicest, but it also assumes that I've
 correctly identified all of the context-sensitive links in the chain.
 I believe you have. I've looked through from `bp_send_email` onwards and I
 can't see anything else. A lot of other options the email code uses are
 site options, which we already handle with `bp_get_option`.
 Swapping `home_url` with `bp_get_root_domain` is a good idea.
 I'm less convinced about adding a `BP_Email` class method for the
 `email.preheader` part as that only sets an (optional) template token.
 Given this is single-use, I don't immediately see a good reason why it
 should be a global function. I think we would be fine to just wrap that
 filter call in `switch_to_blog_` etc.
-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7996#comment:1>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
    
    
More information about the buddypress-trac
mailing list