diff --git src/bp-core/bp-core-filters.php src/bp-core/bp-core-filters.php
index b41c54410..622c2bbce 100644
|
|
|
add_filter( 'update_welcome_email', 'bp_core_filter_blog_welcome_email', 10, 4 ) |
| 461 | 461 | * @return bool Returns false to stop original WPMU function from continuing. |
| 462 | 462 | */ |
| 463 | 463 | function bp_core_activation_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key ) { |
| | 464 | $is_signup_resend = false; |
| | 465 | if ( is_admin() && buddypress()->members->admin->signups_page == get_current_screen()->id ) { |
| | 466 | // The admin is just approving/sending/resending the verification email. |
| | 467 | $is_signup_resend = true; |
| | 468 | } |
| | 469 | |
| 464 | 470 | $args = array( |
| 465 | 471 | 'tokens' => array( |
| 466 | 472 | 'activate-site.url' => esc_url( bp_get_activation_page() . '?key=' . urlencode( $key ) ), |
| … |
… |
function bp_core_activation_signup_blog_notification( $domain, $path, $title, $u |
| 486 | 492 | * |
| 487 | 493 | * @since 10.0.0 |
| 488 | 494 | * |
| 489 | | * @param string $user The user's login name. |
| 490 | | * @param string $user_email The user's email address. |
| 491 | | * @param string $key The activation key created in wpmu_signup_blog(). |
| 492 | | * @param string $domain The new blog domain. |
| 493 | | * @param string $path The new blog path. |
| 494 | | * @param string $title The site title. |
| | 495 | * @param string $user The user's login name. |
| | 496 | * @param string $user_email The user's email address. |
| | 497 | * @param string $key The activation key created in wpmu_signup_blog(). |
| | 498 | * @param bool $is_signup_resend Is the site admin sending this email? |
| | 499 | * @param string $domain The new blog domain. |
| | 500 | * @param string $path The new blog path. |
| | 501 | * @param string $title The site title. |
| 495 | 502 | */ |
| 496 | | if ( apply_filters( 'bp_core_signup_send_activation_key_multisite_blog', true, $user, $user_email, $key, $domain, $path, $title ) ) { |
| | 503 | if ( apply_filters( 'bp_core_signup_send_activation_key_multisite_blog', true, $user, $user_email, $key, $is_signup_resend, $domain, $path, $title ) ) { |
| 497 | 504 | |
| 498 | 505 | bp_send_email( 'core-user-registration-with-blog', array( array( $user_email => $salutation ) ), $args ); |
| 499 | 506 | |
| … |
… |
add_filter( 'wpmu_signup_blog_notification', 'bp_core_activation_signup_blog_not |
| 518 | 525 | * @return false|string Returns false to stop original WPMU function from continuing. |
| 519 | 526 | */ |
| 520 | 527 | function bp_core_activation_signup_user_notification( $user, $user_email, $key, $meta ) { |
| | 528 | $is_signup_resend = false; |
| 521 | 529 | if ( is_admin() ) { |
| 522 | 530 | |
| 523 | 531 | // If the user is created from the WordPress Add User screen, don't send BuddyPress signup notifications. |
| … |
… |
function bp_core_activation_signup_user_notification( $user, $user_email, $key, |
| 531 | 539 | return $user; |
| 532 | 540 | } |
| 533 | 541 | |
| 534 | | /* |
| 535 | | * There can be a case where the user was created without the skip confirmation |
| 536 | | * And the super admin goes in pending accounts to resend it. In this case, as the |
| 537 | | * meta['password'] is not set, the activation url must be WordPress one. |
| 538 | | */ |
| | 542 | // The site admin is approving/resending from the "manage signups" screen. |
| 539 | 543 | } elseif ( buddypress()->members->admin->signups_page == get_current_screen()->id ) { |
| | 544 | /* |
| | 545 | * There can be a case where the user was created without the skip confirmation |
| | 546 | * And the super admin goes in pending accounts to resend it. In this case, as the |
| | 547 | * meta['password'] is not set, the activation url must be WordPress one. |
| | 548 | */ |
| 540 | 549 | $is_hashpass_in_meta = maybe_unserialize( $meta ); |
| 541 | 550 | |
| 542 | 551 | if ( empty( $is_hashpass_in_meta['password'] ) ) { |
| 543 | 552 | return $user; |
| 544 | 553 | } |
| | 554 | |
| | 555 | // Or the admin is just approving/sending/resending the verification email. |
| | 556 | $is_signup_resend = true; |
| 545 | 557 | } |
| 546 | 558 | } |
| 547 | 559 | |
| … |
… |
function bp_core_activation_signup_user_notification( $user, $user_email, $key, |
| 572 | 584 | * |
| 573 | 585 | * @since 10.0.0 |
| 574 | 586 | * |
| 575 | | * @param string $user The user's login name. |
| 576 | | * @param string $user_email The user's email address. |
| 577 | | * @param string $key The activation key created in wpmu_signup_blog(). |
| | 587 | * @param string $user The user's login name. |
| | 588 | * @param string $user_email The user's email address. |
| | 589 | * @param string $key The activation key created in wpmu_signup_blog(). |
| | 590 | * @param bool $is_signup_resend Is the site admin sending this email? |
| 578 | 591 | */ |
| 579 | | if ( apply_filters( 'bp_core_signup_send_activation_key_multisite', true, $user, $user_email, $key ) ) { |
| | 592 | if ( apply_filters( 'bp_core_signup_send_activation_key_multisite', true, $user, $user_email, $key, $is_signup_resend ) ) { |
| 580 | 593 | |
| 581 | 594 | bp_send_email( 'core-user-registration', array( array( $user_email => $salutation ) ), $args ); |
| 582 | 595 | |
| 583 | 596 | } |
| 584 | 597 | |
| 585 | | |
| 586 | 598 | // Return false to stop the original WPMU function from continuing. |
| 587 | 599 | return false; |
| 588 | 600 | } |
| … |
… |
function bp_core_add_meta_to_multisite_signups( $meta ) { |
| 611 | 623 | return $meta; |
| 612 | 624 | } |
| 613 | 625 | add_filter( 'signup_user_meta', 'bp_core_add_meta_to_multisite_signups' ); |
| | 626 | add_filter( 'signup_site_meta', 'bp_core_add_meta_to_multisite_signups' ); |
| 614 | 627 | |
| 615 | 628 | /** |
| 616 | 629 | * Filter the page title for BuddyPress pages. |
diff --git src/bp-members/bp-members-membership-requests.php src/bp-members/bp-members-membership-requests.php
index a55f71726..b0ad8d223 100644
|
|
|
add_filter( 'bp_core_signup_send_activation_key', 'bp_members_membership_request |
| 76 | 76 | * |
| 77 | 77 | * @since 10.0.0 |
| 78 | 78 | * |
| 79 | | * @param bool $send Whether or not to send the activation key. |
| 80 | | * @param string $user_login User login name. |
| 81 | | * @param string $user_email User email address. |
| 82 | | * @param string $activation_key Activation key created in wpmu_signup_user(). |
| | 79 | * @param bool $send Whether or not to send the activation key. |
| | 80 | * @param string $user_login User login name. |
| | 81 | * @param string $user_email User email address. |
| | 82 | * @param string $activation_key Activation key created in wpmu_signup_user(). |
| | 83 | * @param bool $is_signup_resend Is the site admin sending this email? |
| 83 | 84 | * @return bool Whether or not to send the activation key. |
| 84 | 85 | */ |
| 85 | | function bp_members_membership_requests_cancel_activation_email_multisite( $send = true, $user_login = '', $user_email = '', $activation_key = '' ) { |
| | 86 | function bp_members_membership_requests_cancel_activation_email_multisite( $send = true, $user_login = '', $user_email = '', $activation_key = '', $is_signup_resend = false ) { |
| 86 | 87 | |
| 87 | 88 | $details = array( |
| 88 | | 'user_login' => $user_login, |
| 89 | | 'user_email' => $user_email, |
| 90 | | 'activation_key' => $activation_key, |
| | 89 | 'user_login' => $user_login, |
| | 90 | 'user_email' => $user_email, |
| | 91 | 'activation_key' => $activation_key, |
| | 92 | 'is_signup_resend' => $is_signup_resend, |
| 91 | 93 | ); |
| 92 | 94 | |
| | 95 | // Allow the site admin to send/resend approval emails. |
| | 96 | if ( $is_signup_resend ) { |
| | 97 | $to_send = true; |
| | 98 | } else { |
| | 99 | $to_send = false; |
| | 100 | } |
| | 101 | |
| 93 | 102 | /** |
| 94 | 103 | * Allow some membership requests to be approved immediately. |
| 95 | 104 | * For example, you might want to approve all requests |
| … |
… |
function bp_members_membership_requests_cancel_activation_email_multisite( $send |
| 98 | 107 | * |
| 99 | 108 | * @since 10.0.0 |
| 100 | 109 | * |
| 101 | | * @param bool $send Whether or not this membership request should be approved |
| | 110 | * @param bool $to_send Whether or not this membership request should be approved |
| 102 | 111 | * immediately and the activation email sent. |
| 103 | 112 | * Default is `false` meaning that the request should be |
| 104 | 113 | * manually approved by a site admin. |
| 105 | 114 | * @param array $details The details of the request. |
| 106 | 115 | */ |
| 107 | | $send = apply_filters( 'bp_members_membership_requests_bypass_manual_approval_multisite', false, $details ); |
| | 116 | $send = apply_filters( 'bp_members_membership_requests_bypass_manual_approval_multisite', $to_send, $details ); |
| 108 | 117 | |
| 109 | 118 | // If the registration process has been interrupted, this is a new membership request. |
| 110 | 119 | if ( ! $send ) { |
| … |
… |
function bp_members_membership_requests_cancel_activation_email_multisite( $send |
| 123 | 132 | |
| 124 | 133 | return $send; |
| 125 | 134 | } |
| 126 | | add_filter( 'bp_core_signup_send_activation_key_multisite', 'bp_members_membership_requests_cancel_activation_email_multisite', 10, 4 ); |
| 127 | | add_filter( 'bp_core_signup_send_activation_key_multisite_blog', 'bp_members_membership_requests_cancel_activation_email_multisite', 10, 4 ); |
| | 135 | add_filter( 'bp_core_signup_send_activation_key_multisite', 'bp_members_membership_requests_cancel_activation_email_multisite', 10, 5 ); |
| | 136 | add_filter( 'bp_core_signup_send_activation_key_multisite_blog', 'bp_members_membership_requests_cancel_activation_email_multisite', 10, 5 ); |
| 128 | 137 | |
| 129 | 138 | /** |
| 130 | 139 | * Notifications |
diff --git src/bp-members/classes/class-bp-signup.php src/bp-members/classes/class-bp-signup.php
index 76b2022d0..e48d21da4 100644
|
|
|
class BP_Signup { |
| 819 | 819 | |
| 820 | 820 | foreach ( $signups as $signup ) { |
| 821 | 821 | |
| 822 | | $meta = array( |
| 823 | | 'sent_date' => current_time( 'mysql', true ), |
| 824 | | 'count_sent' => $signup->count_sent + 1 |
| 825 | | ); |
| | 822 | $meta = $signup->meta; |
| | 823 | $meta['sent_date'] = current_time( 'mysql', true ); |
| | 824 | $meta['count_sent'] = $signup->count_sent + 1; |
| 826 | 825 | |
| 827 | 826 | // Send activation email. |
| 828 | 827 | if ( is_multisite() ) { |
| 829 | | wpmu_signup_user_notification( $signup->user_login, $signup->user_email, $signup->activation_key, serialize( $meta ) ); |
| | 828 | // Should we send the user or blog activation email? |
| | 829 | if ( ! empty( $signup->domain ) || ! empty( $signup->path ) ) { |
| | 830 | wpmu_signup_blog_notification( $signup->domain, $signup->path, $signup->title, $signup->user_login, $signup->user_email, $signup->activation_key, $meta ); |
| | 831 | } else { |
| | 832 | wpmu_signup_user_notification( $signup->user_login, $signup->user_email, $signup->activation_key, $meta ); |
| | 833 | } |
| 830 | 834 | } else { |
| 831 | 835 | |
| 832 | 836 | // Check user status before sending email. |