[buddypress-trac] [BuddyPress Trac] #8428: Allow to trigger email for activation

buddypress-trac noreply at wordpress.org
Tue Mar 23 21:10:44 UTC 2021


#8428: Allow to trigger email for activation
-------------------------------------+---------------------
 Reporter:  vapvarun                 |       Owner:  DJPaul
     Type:  feature request          |      Status:  new
 Priority:  normal                   |   Milestone:  8.0.0
Component:  Emails                   |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-refresh  |
-------------------------------------+---------------------
Changes (by imath):

 * keywords:  needs-patch => has-patch needs-refresh


Comment:

 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.

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/8428#comment:4>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list