Skip to:
Content

BuddyPress.org

Opened 9 months ago

Closed 6 months ago

#8428 closed feature request (fixed)

Allow to trigger email for activation

Reported by: vapvarun Owned by: DJPaul
Milestone: 8.0.0 Priority: normal
Severity: normal Version:
Component: Emails Keywords: has-patch commit
Cc:

Description

Welcome email can be a nice core feature which we can use to send email after email verification.
Trigger for activation_completed
ref: https://github.com/robertstaddon/buddypress-welcome-email

Attachments (6)

Edit-Email-‹-buddypress-—-WordPress.png (250.0 KB) - added by vapvarun 7 months ago.
Situation to trigger email after activation
BuddyPress-Emails-‹-buddypress-—-WordPress.png (389.4 KB) - added by vapvarun 7 months ago.
Default welcome email - more content can be added
8428.patch (5.5 KB) - added by vapvarun 7 months ago.
initial draft
8428-2.patch (3.4 KB) - added by vapvarun 7 months ago.
updated patch with 8.0.0 updater function
8428.3.patch (4.2 KB) - added by dcavins 6 months ago.
Generalize name up 8.0 email schema upgrade filter function. Harmonize names & keys of welcome email so that upgrade completes without errors.
8428.4.patch (4.8 KB) - added by imath 6 months ago.

Download all attachments as: .zip

Change History (14)

#1 @imath
9 months ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 8.0.0

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


9 months ago

@vapvarun
7 months ago

Situation to trigger email after activation

@vapvarun
7 months ago

Default welcome email - more content can be added

@vapvarun
7 months ago

initial draft

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


7 months ago

#4 @imath
7 months ago

  • Keywords has-patch needs-refresh added; needs-patch removed

Hi @vapvarun

Thanks for your work on this initial patch, sorry for the delay of this first feedback. The first improvement I see is about generating the email post type item when updating to BuddyPress 8.0. FYI, I've already added a function to perform some tasks during this step. Have a look at the bp_update_to_8_0() function into the src/bp-core/bp-core-update.php file.

1) Instead of what you're doing with bp_add_welcome_email(), I believe the right strategy would be to use the bp_core_install_emails() function making sure to add a filter on bp_email_get_schema to only keep the welcome email you've described in it.

eg:

function bp_core_get_welcome_email_schema( $emails ) {
  return array( 'core-user-activation' => $emails['core-user-activation'] );
}

function bp_update_to_8_0() {
  // after the activity migrating code

  add_filter( 'bp_email_get_schema', 'bp_core_get_welcome_email_schema' );

  bp_core_install_emails();

  remove_filter( 'bp_email_get_schema', 'bp_core_get_welcome_email_schema' );
}

PS: I think 'core-user-activation' is enough. You don't need to add a -completed suffix.

2) I think a better place for the function to send the activation email would be after the bp_members_add_role_after_activation(). And I think your should rename it to bp_members_send_welcome_email()

3) About the tokens/message content, I believe including xProfile field values might not be a good idea in some cases, eg: a minimal signup form with only the base profile field. So I believe we should think about a standard welcome message informing about the useful links for the user regarding the active component. A {{{message}}} token could be use like what we're doing in the messages_notification_new_message() function.

#5 @shawfactor
7 months ago

This is cool and I’ll use it but I’d say it is plugin territory...

@vapvarun
7 months ago

updated patch with 8.0.0 updater function

@dcavins
6 months ago

Generalize name up 8.0 email schema upgrade filter function. Harmonize names & keys of welcome email so that upgrade completes without errors.

#6 @imath
6 months ago

  • Keywords needs-testing added; needs-refresh removed

@vapvarun & @dcavins thanks for updating the patch. I believe we should improve the email message some more words about how to reset the password with a link to do it. New members always forget their password!

Otherwise it looks pretty nice. I'll try to test it asap 👍

@imath
6 months ago

#7 @imath
6 months ago

  • Keywords commit added; needs-testing removed

I confirm it's working great. My new patch is just adding the lost password message and a filter to let plugin authors add custom tokens. We're good to go with it!

#8 @imath
6 months ago

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

In 12905:

Add a new BP Email to welcome new members

Once users activated their account, they are now receiving a welcome email with a link to their profile and a link to reset their password in case they forgot about it since they registered.

Props vapvarun, dcavins

Fixes #8428

Note: See TracTickets for help on using tickets.