Skip to:
Content

BuddyPress.org

Changeset 8922


Ignore:
Timestamp:
08/14/2014 08:06:28 PM (10 years ago)
Author:
imath
Message:

Do not interfere with WordPress sign-up process when the user is created from the blog or the network administration.

On multisite config, make sure the activation email and the welcome email generated by WordPress are not modified by BuddyPress if the user was created from the User Administration panel. In this case, user needs to receive the built in activation link and/or the login and password generated by WordPress.

Props godavid33, r-a-y

Fixes #5789

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-filters.php

    r8743 r8922  
    251251
    252252    // Don't touch the email when a user is registered by the site admin
    253     if ( is_admin() )
     253    if ( ( is_admin() || is_network_admin() ) && buddypress()->members->admin->signups_page != get_current_screen()->id ) {
    254254        return $welcome_email;
     255    }
     256
     257    if ( strpos( bp_get_requested_url(), 'wp-activate.php' ) !== false ) {
     258        return $welcome_email;
     259    }
    255260
    256261    // Don't touch the email if we don't have a custom registration template
    257     if ( ! bp_has_custom_signup_page() )
     262    if ( ! bp_has_custom_signup_page() ) {
    258263        return $welcome_email;
     264    }
    259265
    260266    // [User Set] Replaces 'PASSWORD' in welcome email; Represents value set by user
     
    280286function bp_core_filter_blog_welcome_email( $welcome_email, $blog_id, $user_id, $password ) {
    281287
    282     // Don't touch the email when a user is registered by the site admin.
    283     if ( is_admin() )
     288    // Don't touch the email when a user is registered by the site admin
     289    if ( ( is_admin() || is_network_admin() ) && buddypress()->members->admin->signups_page != get_current_screen()->id ) {
    284290        return $welcome_email;
     291    }
    285292
    286293    // Don't touch the email if we don't have a custom registration template
     
    352359function bp_core_activation_signup_user_notification( $user, $user_email, $key, $meta ) {
    353360
     361    if ( is_admin() ) {
     362        // If the user is created from the WordPress Add User screen, don't send BuddyPress signup notifications
     363        if( in_array( get_current_screen()->id, array( 'user', 'user-network' ) ) ) {
     364            // If the Super Admin want to skip confirmation email
     365            if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) {
     366                return false;
     367
     368            // WordPress will manage the signup process
     369            } else {
     370                return $user;
     371            }
     372
     373        /**
     374         * There can be a case where the user was created without the skip confirmation
     375         * And the super admin goes in pending accounts to resend it. In this case, as the
     376         * meta['password'] is not set, the activation url must be WordPress one
     377         */
     378        } else if ( buddypress()->members->admin->signups_page == get_current_screen()->id ) {
     379            $is_hashpass_in_meta = maybe_unserialize( $meta );
     380
     381            if ( empty( $is_hashpass_in_meta['password'] ) ) {
     382                return $user;
     383            }
     384        }
     385    }
     386
    354387    // Set up activation link
    355388    $activate_url = bp_get_activation_page() . "?key=$key";
Note: See TracChangeset for help on using the changeset viewer.