<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[BuddyPress] [2635] trunk: Fixes #1854</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>2635</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-02-08 16:24:52 +0000 (Mon, 08 Feb 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Fixes #1854</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpcorebpcoreactivationphp">trunk/bp-core/bp-core-activation.php</a></li>
<li><a href="#trunkbpcorephp">trunk/bp-core.php</a></li>
<li><a href="#trunkbpthemesbpdefaultfunctionsphp">trunk/bp-themes/bp-default/functions.php</a></li>
<li><a href="#trunkbpthemesbpdefaultregistrationactivatephp">trunk/bp-themes/bp-default/registration/activate.php</a></li>
<li><a href="#trunkbpxprofilebpxprofiletemplatetagsphp">trunk/bp-xprofile/bp-xprofile-templatetags.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpcorebpcoreactivationphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-activation.php (2634 => 2635)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-activation.php        2010-02-08 15:41:53 UTC (rev 2634)
+++ trunk/bp-core/bp-core-activation.php        2010-02-08 16:24:52 UTC (rev 2635)
</span><span class="lines">@@ -82,6 +82,8 @@
</span><span class="cx"> * Since the user now chooses their password, sending it over clear-text to an
</span><span class="cx"> * email address is no longer necessary. It's also a terrible idea security wise.
</span><span class="cx"> *
</span><ins>+ * The only exception to this is when an admin has generated an account for a user.
+ *
</ins><span class="cx"> * This will only disable the email if a custom registration template is being used.
</span><span class="cx"> */
</span><span class="cx"> function bp_core_disable_welcome_email() {
</span><span class="lines">@@ -90,7 +92,8 @@
</span><span class="cx">
</span><span class="cx">         return false;
</span><span class="cx"> }
</span><del>-add_filter( 'wpmu_welcome_user_notification', 'bp_core_disable_welcome_email' );
</del><ins>+if ( !is_admin() && empty( $_GET['e'] ) )
+        add_filter( 'wpmu_welcome_user_notification', 'bp_core_disable_welcome_email' );
</ins><span class="cx">
</span><span class="cx"> // Notify user of signup success.
</span><span class="cx"> function bp_core_activation_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key, $meta ) {
</span><span class="lines">@@ -115,7 +118,8 @@
</span><span class="cx">         // Return false to stop the original WPMU function from continuing
</span><span class="cx">         return false;
</span><span class="cx"> }
</span><del>-add_filter( 'wpmu_signup_blog_notification', 'bp_core_activation_signup_blog_notification', 1, 7 );
</del><ins>+if ( !is_admin() )
+        add_filter( 'wpmu_signup_blog_notification', 'bp_core_activation_signup_blog_notification', 1, 7 );
</ins><span class="cx">
</span><span class="cx"> function bp_core_activation_signup_user_notification( $user, $user_email, $key, $meta ) {
</span><span class="cx">         global $current_site;
</span><span class="lines">@@ -127,9 +131,13 @@
</span><span class="cx">         if ( empty( $admin_email ) )
</span><span class="cx">                 $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
</span><span class="cx">
</span><ins>+        /* If this is an admin generated activation, add a param to email the user login details */
+        if ( is_admin() )
+                $email = '&e=1';
+
</ins><span class="cx">         $from_name = ( '' == get_site_option( "site_name" ) ) ? 'WordPress' : wp_specialchars( get_site_option( "site_name" ) );
</span><span class="cx">         $message_headers = "MIME-Version: 1.0\n" . "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
</span><del>-        $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}" ) );
</del><ins>+        $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, clean_url("http://{$domain}{$path}" ) );
</ins><span class="cx">         $subject = '[' . $from_name . '] ' . __( 'Activate Your Account', 'buddypress' );
</span><span class="cx">
</span><span class="cx">         wp_mail( $user_email, $subject, $message, $message_headers );
</span><span class="lines">@@ -137,6 +145,7 @@
</span><span class="cx">         // Return false to stop the original WPMU function from continuing
</span><span class="cx">         return false;
</span><span class="cx"> }
</span><del>-add_filter( 'wpmu_signup_user_notification', 'bp_core_activation_signup_user_notification', 1, 4 );
</del><ins>+if ( !is_admin() || ( is_admin() && empty( $_POST['noconfirmation'] ) ) )
+        add_filter( 'wpmu_signup_user_notification', 'bp_core_activation_signup_user_notification', 1, 4 );
</ins><span class="cx">
</span><span class="cx"> ?>
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkbpcorephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core.php (2634 => 2635)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core.php        2010-02-08 15:41:53 UTC (rev 2634)
+++ trunk/bp-core.php        2010-02-08 16:24:52 UTC (rev 2635)
</span><span class="lines">@@ -2052,7 +2052,7 @@
</span><span class="cx"> function bp_core_login_redirect() {
</span><span class="cx">         global $bp;
</span><span class="cx">
</span><del>-        if ( false === strpos( wp_get_referer(), 'wp-login.php' ) && empty( $_REQUEST['nr'] ) )
</del><ins>+        if ( false === strpos( wp_get_referer(), 'wp-login.php' ) && false === strpos( wp_get_referer(), 'activate' ) && empty( $_REQUEST['nr'] ) )
</ins><span class="cx">                 return wp_get_referer();
</span><span class="cx">
</span><span class="cx">         return $bp->root_domain;
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/functions.php (2634 => 2635)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/functions.php        2010-02-08 15:41:53 UTC (rev 2634)
+++ trunk/bp-themes/bp-default/functions.php        2010-02-08 16:24:52 UTC (rev 2635)
</span><span class="lines">@@ -207,7 +207,7 @@
</span><span class="cx">
</span><span class="cx"> function bp_dtheme_show_notice() { ?>
</span><span class="cx">         <div id="message" class="updated fade">
</span><del>-                <p><?php printf( __( 'Theme activated! This theme contains <a href="%s">customization options</a> and <a href="%s">custom header image</a> support. <a href="%s">Sidebar widgets</a> are also supported.', 'buddypress' ), admin_url( 'themes.php?page=theme-options-page' ), admin_url( 'themes.php?page=custom-header' ), admin_url( 'widgets.php' ) ) ?></p>
</del><ins>+                <p><?php printf( __( 'Theme activated! This theme contains <a href="%s">custom header image</a> support and <a href="%s">sidebar widgets</a>.', 'buddypress' ), admin_url( 'themes.php?page=custom-header' ), admin_url( 'widgets.php' ) ) ?></p>
</ins><span class="cx">         </div>
</span><span class="cx">
</span><span class="cx">         <style type="text/css">#message2, #message0 { display: none; }</style>
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultregistrationactivatephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/registration/activate.php (2634 => 2635)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/registration/activate.php        2010-02-08 15:41:53 UTC (rev 2634)
+++ trunk/bp-themes/bp-default/registration/activate.php        2010-02-08 16:24:52 UTC (rev 2635)
</span><span class="lines">@@ -17,9 +17,12 @@
</span><span class="cx">
</span><span class="cx">                                 <?php do_action( 'bp_before_activate_content' ) ?>
</span><span class="cx">
</span><del>-                                <p><?php _e( 'Your account was activated successfully! You can now log in with the username and password you provided when you signed up.', 'buddypress' ) ?></p>
</del><ins>+                                <?php if ( isset( $_GET['e'] ) ) : ?>
+                                        <p><?php _e( 'Your account was activated successfully! Your account details have been sent to you in a separate email.', 'buddypress' ) ?></p>
+                                <?php else : ?>
+                                        <p><?php _e( 'Your account was activated successfully! You can now log in with the username and password you provided when you signed up.', 'buddypress' ) ?></p>
+                                <?php endif; ?>
</ins><span class="cx">
</span><del>-
</del><span class="cx">                         <?php else : ?>
</span><span class="cx">
</span><span class="cx">                                 <h3><?php _e( 'Activate your Account', 'buddypress' ) ?></h3>
</span></span></pre></div>
<a id="trunkbpxprofilebpxprofiletemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-xprofile/bp-xprofile-templatetags.php (2634 => 2635)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-xprofile/bp-xprofile-templatetags.php        2010-02-08 15:41:53 UTC (rev 2634)
+++ trunk/bp-xprofile/bp-xprofile-templatetags.php        2010-02-08 16:24:52 UTC (rev 2635)
</span><span class="lines">@@ -453,18 +453,18 @@
</span><span class="cx">                                 }
</span><span class="cx">
</span><span class="cx">                                 /* Check for updated posted values, but errors preventing them from being saved first time */
</span><del>-                                if ( isset( $_POST['field_' . $field->id . '_day'] ) && $day != $_POST['field_' . $field->id . '_day'] ) {
-                                        if ( !empty( $_POST['field_' . $field->id . '_day'] ) )
</del><ins>+                                if ( !empty( $_POST['field_' . $field->id . '_day'] ) ) {
+                                        if ( $day != $_POST['field_' . $field->id . '_day'] )
</ins><span class="cx">                                                 $day = $_POST['field_' . $field->id . '_day'];
</span><span class="cx">                                 }
</span><span class="cx">
</span><del>-                                if ( isset( $_POST['field_' . $field->id . '_month'] ) && $month != $_POST['field_' . $field->id . '_month'] ) {
-                                        if ( !empty( $_POST['field_' . $field->id . '_month'] ) )
</del><ins>+                                if ( !empty( $_POST['field_' . $field->id . '_month'] ) ) {
+                                        if ( $month != $_POST['field_' . $field->id . '_month'] )
</ins><span class="cx">                                                 $month = $_POST['field_' . $field->id . '_month'];
</span><span class="cx">                                 }
</span><span class="cx">
</span><del>-                                if ( isset( $_POST['field_' . $field->id . '_year'] ) && $year != date("j", $_POST['field_' . $field->id . '_year'] ) ) {
-                                        if ( !empty( $_POST['field_' . $field->id . '_year'] ) )
</del><ins>+                                if ( !empty( $_POST['field_' . $field->id . '_year'] ) ) {
+                                        if ( $year != date( "j", $_POST['field_' . $field->id . '_year'] ) )
</ins><span class="cx">                                                 $year = $_POST['field_' . $field->id . '_year'];
</span><span class="cx">                                 }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>