Skip to:
Content

BuddyPress.org

Opened 3 years ago

Closed 3 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
Milestone: 2.7 Priority: normal
Severity: normal Version:
Component: Friends 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?

Attachments (1)

7221.01.patch (564 bytes) - added by r-a-y 3 years ago.

Download all attachments as: .zip

Change History (3)

#1 @r-a-y
3 years ago

  • Keywords has-patch added; dev-feedback removed
  • Milestone changed from Awaiting Review to 2.7

Good catch, wpdennis!

Looks like some old code. We should probably use the 'bp_actions' hook instead of 'bp_init'.

@r-a-y
3 years ago

#2 @r-a-y
3 years ago

  • Owner set to r-a-y
  • Resolution set to fixed
  • Status changed from new to closed

In 11047:

Friends: Move friend action hooks to 'bp_actions'.

Previously, these hooks were running on 'bp_init', which is too early.

Props wpdennis.

Fixes #7221.

Note: See TracTickets for help on using tickets.