Skip to:
Content

BuddyPress.org

Ticket #8428: 8428-2.patch

File 8428-2.patch, 3.4 KB (added by vapvarun, 8 months ago)

updated patch with 8.0.0 updater function

  • src/bp-core/bp-core-functions.php

    diff --git src/bp-core/bp-core-functions.php src/bp-core/bp-core-functions.php
    index 592f5b155..12bf4defc 100644
    function bp_email_get_schema() { 
    36843684         * @param array $emails The array of emails schema.
    36853685         */
    36863686        return (array) apply_filters( 'bp_email_get_schema', array(
     3687                'core-user-activation' => array(
     3688                        /* translators: do not remove {} brackets or translate its contents. */
     3689                        'post_title'   => __( '[{{{site.name}}}] Welcome!', 'buddypress' ),
     3690                        /* translators: do not remove {} brackets or translate its contents. */
     3691                        'post_content' => __( "Hi {{{displayname}}},\n\nWelcome to [{{{site.name}}}]!", 'buddypress' ),
     3692                        /* translators: do not remove {} brackets or translate its contents. */
     3693                        'post_excerpt' => __( "Hi {{{displayname}}},\n\nWelcome to [{{{site.name}}}]!", 'buddypress' ),
     3694                ),
    36873695                'activity-comment' => array(
    36883696                        /* translators: do not remove {} brackets or translate its contents. */
    36893697                        'post_title'   => __( '[{{{site.name}}}] {{poster.name}} replied to one of your updates', 'buddypress' ),
    function bp_email_get_type_schema( $field = 'description' ) { 
    39563964                ),
    39573965        );
    39583966
     3967        $core_user_activation_completed = array(
     3968                'description'   => __( 'Recipient has successfully activated an account.', 'buddypress' ),
     3969        );
     3970
    39593971        $types = array(
    39603972                'activity-comment'                   => $activity_comment,
    39613973                'activity-comment-author'            => $activity_comment_author,
    function bp_email_get_type_schema( $field = 'description' ) { 
    39733985                'settings-verify-email-change'       => $settings_verify_email_change,
    39743986                'groups-membership-request-accepted' => $groups_membership_request_accepted,
    39753987                'groups-membership-request-rejected' => $groups_membership_request_rejected,
     3988                'core-user-activation-completed'                 => $core_user_activation_completed,
    39763989        );
    39773990
    39783991        if ( $field !== 'all' ) {
  • src/bp-core/bp-core-update.php

    diff --git src/bp-core/bp-core-update.php src/bp-core/bp-core-update.php
    index a7791c445..a8fd1391a 100644
    function bp_update_to_5_0() { 
    604604function bp_update_to_8_0() {
    605605        global $wpdb;
    606606        $bp_prefix = bp_core_get_table_prefix();
     607        // Install welcome email to email list.
     608        add_filter( 'bp_email_get_schema', 'bp_core_get_welcome_email_schema' );
     609
     610        bp_core_install_emails();
     611
     612        remove_filter( 'bp_email_get_schema', 'bp_core_get_welcome_email_schema' );
    607613
    608614        // Update the `new_avatar` activity type's component to `members`.
    609615        $wpdb->update(
  • src/bp-members/bp-members-functions.php

    diff --git src/bp-members/bp-members-functions.php src/bp-members/bp-members-functions.php
    index 165bc97c3..8a720e6a4 100644
    function bp_members_avatar_upload_dir( $directory = 'avatars', $user_id = 0 ) { 
    33063306                'error'   => false
    33073307        ) );
    33083308}
     3309
     3310/**
     3311 * Send Core user welcome email on user activation link
     3312 *
     3313 * @since 8.0.0
     3314 *
     3315 * @param int $user_id The user ID
     3316 */
     3317
     3318 function bp_send_welcome_email( $user_id ){
     3319        // add tokens to parse in email
     3320        $args = array(
     3321                'tokens' => array(
     3322                                'displayname'    => bp_core_get_user_displayname( $user_id ),
     3323                        ),
     3324        );
     3325
     3326        // send args and user ID to receive email
     3327        bp_send_email( 'core-user-activation', $user_id, $args );
     3328 }
     3329 add_action( 'bp_core_activated_user', 'bp_send_welcome_email' );