Skip to:
Content

BuddyPress.org

Changeset 2157


Ignore:
Timestamp:
11/30/2009 12:25:30 AM (17 years ago)
Author:
apeatling
Message:

Fixing incorrect activation email link.

Location:
trunk/bp-core
Files:
2 edited

Legend:

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

    r2077 r2157  
    9696add_filter( 'wpmu_welcome_user_notification', 'bp_core_disable_welcome_email' );
    9797
    98 /***
    99  * bp_core_filter_activation_email()
    100  *
    101  * Filter the activation email to remove the line stating that another email will be sent
    102  * with the generated login details. This is not the case due to bp_core_disable_welcome_email()
    103  */
    104 function bp_core_filter_activation_email( $email ) {
    105         if ( '' == locate_template( array( 'registration/register.php' ), false ) && '' == locate_template( array( 'register.php' ), false ) )
    106                 return $email;
     98// Notify user of signup success.
     99function bp_core_activation_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key, $meta ) {
     100        global $current_site;
    107101
    108         return str_replace( __( 'After you activate, you will receive *another email* with your login.', 'buddypress' ), '', $email );
     102        // Send email with activation link.
     103        if ( 'no' == constant( "VHOST" ) ) {
     104                $activate_url = bp_activation_page( false ) . "?key=$key";
     105        } else {
     106                $activate_url = bp_activation_page( false ) ."?key=$key";
     107        }
     108
     109        $activate_url = clean_url($activate_url);
     110        $admin_email = get_site_option( "admin_email" );
     111
     112        if ( empty( $admin_email ) )
     113                $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
     114
     115        $from_name = ( '' == get_site_option( "site_name" ) ) ? 'WordPress' : wp_specialchars( get_site_option( "site_name" ) );
     116        $message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
     117        $message = sprintf(__("Thanks for registering! To complete the activation of your account and blog, please click the following link:\n\n%s\n\n\n\nAfter you activate, you can visit your blog here:\n\n%s", 'buddypress' ), $activate_url, clean_url("http://{$domain}{$path}" ) );
     118        $subject = '[' . $from_name . '] ' . sprintf(__('Activate %s', 'buddypress' ), clean_url('http://' . $domain . $path));
     119
     120        wp_mail($user_email, $subject, $message, $message_headers);
     121
     122        // Return false to stop the original WPMU function from continuing
     123        return false;
    109124}
    110 add_filter( 'wpmu_signup_user_notification_email', 'bp_core_filter_activation_email' );
    111 add_filter( 'wpmu_signup_blog_notification_email', 'bp_core_filter_activation_email' );
     125add_filter( 'wpmu_signup_blog_notification', 'bp_core_activation_signup_blog_notification', 1, 7 );
     126
     127function bp_core_activation_signup_user_notification( $user, $user_email, $key, $meta ) {
     128        global $current_site;
     129
     130        // Send email with activation link.
     131        if ( 'no' == constant( "VHOST" ) ) {
     132                $activate_url = bp_activation_page( false ) . "?key=$key";
     133        } else {
     134                $activate_url = bp_activation_page( false ) ."?key=$key";
     135        }
     136
     137        $activate_url = clean_url($activate_url);
     138        $admin_email = get_site_option( "admin_email" );
     139
     140        if ( empty( $admin_email ) )
     141                $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
     142
     143        $from_name = ( '' == get_site_option( "site_name" ) ) ? 'WordPress' : wp_specialchars( get_site_option( "site_name" ) );
     144        $message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
     145        $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, clean_url("http://{$domain}{$path}" ) );
     146        $subject = '[' . $from_name . '] ' . sprintf(__('Activate %s', 'buddypress' ), clean_url('http://' . $domain . $path));
     147
     148        wp_mail($user_email, $subject, $message, $message_headers);
     149
     150        // Return false to stop the original WPMU function from continuing
     151        return false;
     152}
     153add_filter( 'wpmu_signup_user_notification', 'bp_core_activation_signup_user_notification', 1, 4 );
    112154
    113155?>
  • trunk/bp-core/deprecated/bp-core-deprecated.php

    r2114 r2157  
    540540}
    541541
    542 // Notify user of signup success.
    543 function bp_core_activation_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key, $meta ) {
    544         global $current_site;
    545 
    546         // Send email with activation link.
    547         if ( 'no' == constant( "VHOST" ) ) {
    548                 $activate_url = bp_activation_page( false ) . "?key=$key";
    549         } else {
    550                 $activate_url = bp_activation_page( false ) ."?key=$key";
    551         }
    552 
    553         $activate_url = clean_url($activate_url);
    554         $admin_email = get_site_option( "admin_email" );
    555 
    556         if ( empty( $admin_email ) )
    557                 $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
    558 
    559         $from_name = ( '' == get_site_option( "site_name" ) ) ? 'WordPress' : wp_specialchars( get_site_option( "site_name" ) );
    560         $message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
    561         $message = sprintf(__("To activate your blog, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login.\n\nAfter you activate, you can visit your blog here:\n\n%s", 'buddypress' ), $activate_url, clean_url("http://{$domain}{$path}" ) );
    562         $subject = '[' . $from_name . '] ' . sprintf(__('Activate %s', 'buddypress' ), clean_url('http://' . $domain . $path));
    563 
    564         wp_mail($user_email, $subject, $message, $message_headers);
    565 
    566         // Return false to stop the original WPMU function from continuing
    567         return false;
    568 }
    569 
    570 function bp_core_activation_signup_user_notification( $user, $user_email, $key, $meta ) {
    571         global $current_site;
    572 
    573         if( !apply_filters('wpmu_signup_user_notification', $user, $user_email, $key, $meta) )
    574                 return false;
    575 
    576         // Send email with activation link.
    577         $admin_email = get_site_option( "admin_email" );
    578 
    579         if ( $admin_email == '' )
    580                 $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
    581 
    582         $from_name = get_site_option( "site_name" ) == '' ? 'WordPress' : wp_specialchars( get_site_option( "site_name" ) );
    583         $message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
    584         $message = sprintf( apply_filters( 'wpmu_signup_user_notification_email', __( "To activate your user, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login.\n\n" ) ), site_url( "wp-activate.php?key=$key" ), $key );
    585 
    586         // TODO: Don't hard code activation link.
    587         $subject = sprintf(__( apply_filters( 'wpmu_signup_user_notification_subject', 'Activate %s' )), $user);
    588         wp_mail($user_email, $subject, $message, $message_headers);
    589 
    590         // Return false to stop the original WPMU function from continuing
    591         return false;
    592 }
    593 
    594 function bp_core_load_deprecated_signup_email_functions() {
    595         /* If we are using a BuddyPress 1.1+ theme ignore this. */
    596         if ( !file_exists( WP_CONTENT_DIR . '/bp-themes' ) )
    597                 return false;
    598 
    599         add_filter( 'wpmu_signup_user_notification', 'bp_core_activation_signup_user_notification', 1, 4 );
    600         add_filter( 'wpmu_signup_blog_notification', 'bp_core_activation_signup_blog_notification', 1, 7 );
    601 }
    602 add_action( 'plugins_loaded', 'bp_core_load_deprecated_signup_email_functions' );
    603 
    604542/*** END DEPRECATED SIGNUP FUNCTIONS **********/
    605543
Note: See TracChangeset for help on using the changeset viewer.