diff --git src/bp-core/bp-core-filters.php src/bp-core/bp-core-filters.php
index d02e324..069014a 100644
|
|
|
add_filter( 'bp_login_redirect', 'bp_core_login_redirect', 10, 3 ); |
| 250 | 250 | function bp_core_filter_user_welcome_email( $welcome_email ) { |
| 251 | 251 | |
| 252 | 252 | // 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 ) { |
| 254 | 254 | return $welcome_email; |
| | 255 | } |
| | 256 | |
| | 257 | if ( strpos( bp_get_requested_url(), 'wp-activate.php' ) !== false ) { |
| | 258 | return $welcome_email; |
| | 259 | } |
| 255 | 260 | |
| 256 | 261 | // 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() ) { |
| 258 | 263 | return $welcome_email; |
| | 264 | } |
| 259 | 265 | |
| 260 | 266 | // [User Set] Replaces 'PASSWORD' in welcome email; Represents value set by user |
| 261 | 267 | return str_replace( 'PASSWORD', __( '[User Set]', 'buddypress' ), $welcome_email ); |
| … |
… |
add_filter( 'update_welcome_user_email', 'bp_core_filter_user_welcome_email' ); |
| 279 | 285 | */ |
| 280 | 286 | function bp_core_filter_blog_welcome_email( $welcome_email, $blog_id, $user_id, $password ) { |
| 281 | 287 | |
| 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 ) { |
| 284 | 290 | return $welcome_email; |
| | 291 | } |
| 285 | 292 | |
| 286 | 293 | // Don't touch the email if we don't have a custom registration template |
| 287 | 294 | if ( ! bp_has_custom_signup_page() ) |
| … |
… |
add_filter( 'wpmu_signup_blog_notification', 'bp_core_activation_signup_blog_not |
| 351 | 358 | */ |
| 352 | 359 | function bp_core_activation_signup_user_notification( $user, $user_email, $key, $meta ) { |
| 353 | 360 | |
| | 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 | |
| 354 | 387 | // Set up activation link |
| 355 | 388 | $activate_url = bp_get_activation_page() . "?key=$key"; |
| 356 | 389 | $activate_url = esc_url( $activate_url ); |