Skip to:
Content

BuddyPress.org

Opened 4 years ago

Closed 4 years ago

#6912 closed defect (bug) (fixed)

BP Email prevents the activation email to be resent by the admin / BP Email fails when used in an Administration screen

Reported by: imath Owned by: imath
Milestone: 2.5 Priority: high
Severity: blocker Version:
Component: Administration Keywords: commit
Cc:

Description

If you try to resend the activation email from the Signups Administration screen, although the feedback message tells you the email was sent, it's actually not sent.

That's because the BP Email feature relies on the bp_locate_template() function to get the template, and we cannot load a template into an administration screen. I had a similar issue with the Avatar UI (#6348) and we finally used require.

But i don't think we can do this here, as this would prevent template overrides...

To be sure that was the problem, i've used the mail-admin.patch and i confirm using it, the email is sent successfully.

Attachments (2)

mail-admin.patch (1.5 KB) - added by imath 4 years ago.
6912.patch (1.5 KB) - added by imath 4 years ago.

Download all attachments as: .zip

Change History (11)

@imath
4 years ago

#1 @imath
4 years ago

  • Summary changed from BP Email prevents the activation email to be resend by the admin / BP Email fails when used in an Administration screen to BP Email prevents the activation email to be resent by the admin / BP Email fails when used in an Administration screen

This ticket was mentioned in Slack in #buddypress by imath. View the logs.


4 years ago

#3 @DJPaul
4 years ago

Is WP_USE_THEMES not set in wp-admin?

#4 @DJPaul
4 years ago

I think your patch is OK. Thanks for finding this issue and working on a fix.

Maybe we can revisit in a future release *why* this function should not load the template inside wp-admin -- is that something we're doing somewhere? Or is it a decision from old code?

#5 @DJPaul
4 years ago

  • Keywords commit added

#6 @DJPaul
4 years ago

Actually maybe make the filter name resemble the function name more, maybe bp_locate_template_and_load ??

#7 @imath
4 years ago

6912.patch uses bp_locate_template_and_load for the filter name.

is that something we're doing somewhere? Or is it a decision from old code?

It's something i had to face for the avatar UI, but i don't know why we restrict template parts loading inside Administration screens.

@imath
4 years ago

#8 @DJPaul
4 years ago

go for it. let's try to figure out why not template parts inside wp-admin for 2.6, might not be a good reason. :)

#9 @imath
4 years ago

  • Owner set to imath
  • Resolution set to fixed
  • Status changed from new to closed

In 10594:

Make sure the BuddyPress Email template can be loaded within the WordPress Administration.

bp_locate_template() is only loading templates if WP_USE_THEMES is defined or if an Ajax request is done, which is not the case inside a regular Administration page. As the email template is a required parameter for the BP_Email class, this was preventing any email to be sent from the WordPress Administration (eg: the activation email using the "resend" action from the Signups screen).
To fix this we are introducing a new filter the BP_Email class is using to get the email template.

Fixes #6912

Note: See TracTickets for help on using tickets.