Changeset 10479 for trunk/src/bp-core/bp-core-filters.php
- Timestamp:
- 01/27/2016 09:15:07 PM (10 years ago)
- File:
-
- 1 edited
-
trunk/src/bp-core/bp-core-filters.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-filters.php
r10477 r10479 241 241 } 242 242 add_filter( 'nav_menu_css_class', 'bp_core_menu_highlight_nav_menu_item', 10, 2 ); 243 244 /**245 * Set "From" name in outgoing email to the site name.246 *247 * @uses bp_get_option() fetches the value for a meta_key in the wp_X_options table.248 *249 * @return string The blog name for the root blog.250 */251 function bp_core_email_from_name_filter() {252 253 /**254 * Filters the "From" name in outgoing email to the site name.255 *256 * @since 1.2.0257 *258 * @param string $value Value to set the "From" name to.259 */260 return apply_filters( 'bp_core_email_from_name_filter', bp_get_option( 'blogname', 'WordPress' ) );261 }262 add_filter( 'wp_mail_from_name', 'bp_core_email_from_name_filter' );263 243 264 244 /** … … 434 414 * WP's default welcome email with a BuddyPress-specific message. 435 415 * 436 * @see wpmu_signup_blog_notification() for a description of parameters.437 *438 416 * @param string $domain The new blog domain. 439 417 * @param string $path The new blog path. … … 442 420 * @param string $user_email The user's email address. 443 421 * @param string $key The activation key created in wpmu_signup_blog(). 444 * @param array $meta By default, contains the requested privacy setting and 445 * lang_id. 446 * @return bool True on success, false on failure. 447 */ 448 function bp_core_activation_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key, $meta ) { 449 450 // Set up activation link. 451 $activate_url = bp_get_activation_page() ."?key=$key"; 452 $activate_url = esc_url( $activate_url ); 453 454 // Email contents. 455 $message = sprintf( __( "%1\$s,\n\n\n\nThanks for registering! To complete the activation of your account and blog, please click the following link:\n\n%2\$s\n\n\n\nAfter you activate, you can visit your blog here:\n\n%3\$s", 'buddypress' ), $user, $activate_url, esc_url( "http://{$domain}{$path}" ) ); 456 $subject = bp_get_email_subject( array( 'text' => sprintf( __( 'Activate %s', 'buddypress' ), 'http://' . $domain . $path ) ) ); 457 458 /** 459 * Filters the email that the notification is going to upon successful registration with blog. 460 * 461 * @since 1.2.0 462 * 463 * @param string $user_email The user's email address. 464 * @param string $domain The new blog domain. 465 * @param string $path The new blog path. 466 * @param string $title The site title. 467 * @param string $user The user's login name. 468 * @param string $user_email The user's email address. 469 * @param string $key The activation key created in wpmu_signup_blog(). 470 * @param array $meta Array of meta values for the created site. 471 */ 472 $to = apply_filters( 'bp_core_activation_signup_blog_notification_to', $user_email, $domain, $path, $title, $user, $user_email, $key, $meta ); 473 474 /** 475 * Filters the subject that the notification uses upon successful registration with blog. 476 * 477 * @since 1.2.0 478 * 479 * @param string $subject The subject to use. 480 * @param string $domain The new blog domain. 481 * @param string $path The new blog path. 482 * @param string $title The site title. 483 * @param string $user The user's login name. 484 * @param string $user_email The user's email address. 485 * @param string $key The activation key created in wpmu_signup_blog(). 486 * @param array $meta Array of meta values for the created site. 487 */ 488 $subject = apply_filters( 'bp_core_activation_signup_blog_notification_subject', $subject, $domain, $path, $title, $user, $user_email, $key, $meta ); 489 490 /** 491 * Filters the message that the notification uses upon successful registration with blog. 492 * 493 * @since 1.2.0 494 * 495 * @param string $message The message to use. 496 * @param string $domain The new blog domain. 497 * @param string $path The new blog path. 498 * @param string $title The site title. 499 * @param string $user The user's login name. 500 * @param string $user_email The user's email address. 501 * @param string $key The activation key created in wpmu_signup_blog(). 502 * @param array $meta Array of meta values for the created site. 503 */ 504 $message = apply_filters( 'bp_core_activation_signup_blog_notification_message', $message, $domain, $path, $title, $user, $user_email, $key, $meta ); 505 506 // Send the email. 507 wp_mail( $to, $subject, $message ); 508 509 // Set up the $admin_email to pass to the filter. 510 $admin_email = bp_get_option( 'admin_email' ); 511 512 /** 513 * Fires after the sending of the notification to new users for successful registration with blog. 514 * 515 * @since 1.5.0 516 * 517 * @param string $admin_email Admin Email address for the site. 518 * @param string $subject Subject used in the notification email. 519 * @param string $message Message used in the notification email. 520 * @param string $domain The new blog domain. 521 * @param string $path The new blog path. 522 * @param string $title The site title. 523 * @param string $user The user's login name. 524 * @param string $user_email The user's email address. 525 * @param string $key The activation key created in wpmu_signup_blog(). 526 * @param array $meta Array of meta values for the created site. 527 */ 528 do_action( 'bp_core_sent_blog_signup_email', $admin_email, $subject, $message, $domain, $path, $title, $user, $user_email, $key, $meta ); 422 * @return bool Returns false to stop original WPMU function from continuing. 423 */ 424 function bp_core_activation_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key ) { 425 $args = array( 426 'tokens' => array( 427 'activate-site.url' => esc_url( bp_get_activation_page() . '?key=' . urlencode( $key ) ), 428 'domain' => $domain, 429 'key_blog' => $key, 430 'path' => $path, 431 'user-site.url' => esc_url( "http://{$domain}{$path}" ), 432 'title' => $title, 433 'user.email' => $user_email, 434 ), 435 ); 436 bp_send_email( 'core-user-registration-with-blog', $user_email, $args ); 529 437 530 438 // Return false to stop the original WPMU function from continuing. 531 439 return false; 532 440 } 533 add_filter( 'wpmu_signup_blog_notification', 'bp_core_activation_signup_blog_notification', 1, 7);441 add_filter( 'wpmu_signup_blog_notification', 'bp_core_activation_signup_blog_notification', 1, 6 ); 534 442 535 443 /** … … 542 450 * @param string $key The activation key created in wpmu_signup_user(). 543 451 * @param array $meta By default, an empty array. 544 * @return bool|string True on success, false on failure.452 * @return bool|string Returns false to stop original WPMU function from continuing. 545 453 */ 546 454 function bp_core_activation_signup_user_notification( $user, $user_email, $key, $meta ) { 547 548 455 if ( is_admin() ) { 456 549 457 // If the user is created from the WordPress Add User screen, don't send BuddyPress signup notifications. 550 458 if( in_array( get_current_screen()->id, array( 'user', 'user-network' ) ) ) { … … 558 466 } 559 467 560 /* *468 /* 561 469 * There can be a case where the user was created without the skip confirmation 562 470 * And the super admin goes in pending accounts to resend it. In this case, as the … … 572 480 } 573 481 574 // Set up activation link. 575 $activate_url = bp_get_activation_page() . "?key=$key"; 576 $activate_url = esc_url( $activate_url ); 577 578 // Email contents. 579 $message = sprintf( __( "Thanks for registering! To complete the activation of your account please click the following link:\n\n%1\$s\n\n", 'buddypress' ), $activate_url ); 580 $subject = bp_get_email_subject( array( 'text' => __( 'Activate Your Account', 'buddypress' ) ) ); 581 582 /** 583 * Filters the email that the notification is going to upon successful registration without blog. 584 * 585 * @since 1.2.0 586 * 587 * @param string $user_email The user's email address. 588 * @param string $user The user's login name. 589 * @param string $user_email The user's email address. 590 * @param string $key The activation key created in wpmu_signup_blog(). 591 * @param array $meta Array of meta values for the created site. 592 */ 593 $to = apply_filters( 'bp_core_activation_signup_user_notification_to', $user_email, $user, $user_email, $key, $meta ); 594 595 /** 596 * Filters the subject that the notification uses upon successful registration without blog. 597 * 598 * @since 1.2.0 599 * 600 * @param string $subject The subject to use. 601 * @param string $user The user's login name. 602 * @param string $user_email The user's email address. 603 * @param string $key The activation key created in wpmu_signup_blog(). 604 * @param array $meta Array of meta values for the created site. 605 */ 606 $subject = apply_filters( 'bp_core_activation_signup_user_notification_subject', $subject, $user, $user_email, $key, $meta ); 607 608 /** 609 * Filters the message that the notification uses upon successful registration without blog. 610 * 611 * @since 1.2.0 612 * 613 * @param string $message The message to use. 614 * @param string $user The user's login name. 615 * @param string $user_email The user's email address. 616 * @param string $key The activation key created in wpmu_signup_blog(). 617 * @param array $meta Array of meta values for the created site. 618 */ 619 $message = apply_filters( 'bp_core_activation_signup_user_notification_message', $message, $user, $user_email, $key, $meta ); 620 621 // Send the email. 622 wp_mail( $to, $subject, $message ); 623 624 // Set up the $admin_email to pass to the filter. 625 $admin_email = bp_get_option( 'admin_email' ); 626 627 /** 628 * Fires after the sending of the notification to new users for successful registration without blog. 629 * 630 * @since 1.5.0 631 * 632 * @param string $admin_email Admin Email address for the site. 633 * @param string $subject Subject used in the notification email. 634 * @param string $message Message used in the notification email. 635 * @param string $user The user's login name. 636 * @param string $user_email The user's email address. 637 * @param string $key The activation key created in wpmu_signup_blog(). 638 * @param array $meta Array of meta values for the created site. Default empty array. 639 */ 640 do_action( 'bp_core_sent_user_signup_email', $admin_email, $subject, $message, $user, $user_email, $key, $meta ); 482 $args = array( 483 'tokens' => array( 484 'activate.url' => esc_url( trailingslashit( bp_get_activation_page() ) . "{$key}/" ), 485 'key' => $key, 486 'user.email' => $user_email, 487 ), 488 ); 489 bp_send_email( 'core-user-registration', $user_email, $args ); 641 490 642 491 // Return false to stop the original WPMU function from continuing.
Note: See TracChangeset
for help on using the changeset viewer.