Opened 10 years ago
Closed 10 years ago
#7221 closed enhancement (fixed)
Consider executing "friends_action_add_friend" not during WP`s init()
| Reported by: | wpdennis | Owned by: | r-a-y |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.7 |
| Component: | Friends | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | info@… |
Description
friends_action_add_friend() is running in bp_init(). So this function sends the corresponding email and redirects the visitor while we are in WP's init().
If domain specific customizing is hooked into bp_init/init too (e.g. customizing the from adresse for emails via bp_email_get_from or wp_mail_from_name), you have to know the priority / load order to ensure the filters are running.
I think sending emails and redirecting in WP`s init is a bit too early. Wouldn't something like "wp_loaded" be a safer place, to ensure all filters added to bp_init/init are finished?
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Good catch, wpdennis!
Looks like some old code. We should probably use the
'bp_actions'hook instead of'bp_init'.