Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/22/2011 07:41:12 PM (15 years ago)
Author:
johnjamesjacoby
Message:

Clean up sign-up notification functions and remove unused $current_site globals.

File:
1 edited

Legend:

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

    r4991 r5025  
    4848 *
    4949 * @package BuddyPress Core
    50  * @global $current_site Object containing current site metadata
    5150 * @return noreply@sitedomain email address
    5251 */
     
    191190// Notify user of signup success.
    192191function bp_core_activation_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key, $meta ) {
    193         global $current_site;
    194192
    195193        // Send email with activation link.
    196194        $activate_url = bp_get_activation_page() ."?key=$key";
    197         $activate_url = esc_url($activate_url);
    198 
    199         $admin_email = get_site_option( "admin_email" );
     195        $activate_url = esc_url( $activate_url );
     196
     197        $admin_email = get_site_option( 'admin_email' );
    200198
    201199        if ( empty( $admin_email ) )
    202200                $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
    203201
    204         $from_name = ( '' == get_site_option( "site_name" ) ) ? 'WordPress' : esc_html( get_site_option( "site_name" ) );
    205         $message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
    206         $message = sprintf( __( "Thanks for registering! To complete the activation of your account and blog, please click the following link:\n\n%1$s\n\n\n\nAfter you activate, you can visit your blog here:\n\n%2$s", 'buddypress' ), $activate_url, esc_url("http://{$domain}{$path}" ) );
    207         $subject = '[' . $from_name . '] ' . sprintf(__('Activate %s', 'buddypress' ), esc_url('http://' . $domain . $path));
    208 
    209         /* Send the message */
    210         $to = apply_filters( 'bp_core_activation_signup_blog_notification_to', $user_email, $domain, $path, $title, $user, $user_email, $key, $meta );
    211         $subject = apply_filters( 'bp_core_activation_signup_blog_notification_subject', $subject, $domain, $path, $title, $user, $user_email, $key, $meta );
    212         $message = apply_filters( 'bp_core_activation_signup_blog_notification_message', $message, $domain, $path, $title, $user, $user_email, $key, $meta );
     202        $from_name       = ( '' == get_site_option( 'site_name' ) ) ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
     203        $message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option( 'blog_charset' ) . "\"\n";
     204        $message         = sprintf( __( "Thanks for registering! To complete the activation of your account and blog, please click the following link:\n\n%1$s\n\n\n\nAfter you activate, you can visit your blog here:\n\n%2$s", 'buddypress' ), $activate_url, esc_url( "http://{$domain}{$path}" ) );
     205        $subject         = '[' . $from_name . '] ' . sprintf(__('Activate %s', 'buddypress' ), esc_url( 'http://' . $domain . $path ) );
     206
     207        // Send the message
     208        $to              = apply_filters( 'bp_core_activation_signup_blog_notification_to',  $user_email, $domain, $path, $title, $user, $user_email, $key, $meta );
     209        $subject         = apply_filters( 'bp_core_activation_signup_blog_notification_subject', $subject, $domain, $path, $title, $user, $user_email, $key, $meta );
     210        $message         = apply_filters( 'bp_core_activation_signup_blog_notification_message', $message, $domain, $path, $title, $user, $user_email, $key, $meta );
    213211
    214212        wp_mail( $to, $subject, $message, $message_headers );
     
    223221
    224222function bp_core_activation_signup_user_notification( $user, $user_email, $key, $meta ) {
    225         global $current_site;
    226 
    227         $activate_url = bp_get_activation_page() ."?key=$key";
     223
     224        $activate_url = bp_get_activation_page() . "?key=$key";
    228225        $activate_url = esc_url($activate_url);
    229         $admin_email = get_site_option( "admin_email" );
     226        $admin_email  = get_site_option( 'admin_email' );
    230227
    231228        if ( empty( $admin_email ) )
    232229                $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
    233230
    234         /* If this is an admin generated activation, add a param to email the user login details */
     231        // If this is an admin generated activation, add a param to email the
     232        // user login details
    235233        $email = is_admin() ? '&e=1' : '';
    236234
    237         $from_name = ( '' == get_site_option( "site_name" ) ) ? 'WordPress' : esc_html( get_site_option( "site_name" ) );
    238         $message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
    239         $message = sprintf( __( "Thanks for registering! To complete the activation of your account please click the following link:\n\n%s\n\n", 'buddypress' ), $activate_url . $email );
    240         $subject = '[' . $from_name . '] ' . __( 'Activate Your Account', 'buddypress' );
    241 
    242         /* Send the message */
    243         $to = apply_filters( 'bp_core_activation_signup_user_notification_to', $user_email, $user, $user_email, $key, $meta );
     235        $from_name       = ( '' == get_site_option( 'site_name' ) ) ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
     236        $message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option( 'blog_charset' ) . "\"\n";
     237        $message         = sprintf( __( "Thanks for registering! To complete the activation of your account please click the following link:\n\n%s\n\n", 'buddypress' ), $activate_url . $email );
     238        $subject         = '[' . $from_name . '] ' . __( 'Activate Your Account', 'buddypress' );
     239
     240        // Send the message
     241        $to      = apply_filters( 'bp_core_activation_signup_user_notification_to',  $user_email, $user, $user_email, $key, $meta );
    244242        $subject = apply_filters( 'bp_core_activation_signup_user_notification_subject', $subject, $user, $user_email, $key, $meta );
    245243        $message = apply_filters( 'bp_core_activation_signup_user_notification_message', $message, $user, $user_email, $key, $meta );
Note: See TracChangeset for help on using the changeset viewer.