<!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() &amp;&amp; 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 = '&amp;e=1';
+
</ins><span class="cx">         $from_name = ( '' == get_site_option( &quot;site_name&quot; ) ) ? 'WordPress' : wp_specialchars( get_site_option( &quot;site_name&quot; ) );
</span><span class="cx">         $message_headers = &quot;MIME-Version: 1.0\n&quot; . &quot;From: \&quot;{$from_name}\&quot; &lt;{$admin_email}&gt;\n&quot; . &quot;Content-Type: text/plain; charset=\&quot;&quot; . get_option('blog_charset') . &quot;\&quot;\n&quot;;
</span><del>-        $message = sprintf( __( &quot;Thanks for registering! To complete the activation of your account please click the following link:\n\n%s\n\n&quot;, 'buddypress' ), $activate_url, clean_url(&quot;http://{$domain}{$path}&quot; ) );
</del><ins>+        $message = sprintf( __( &quot;Thanks for registering! To complete the activation of your account please click the following link:\n\n%s\n\n&quot;, 'buddypress' ), $activate_url . $email, clean_url(&quot;http://{$domain}{$path}&quot; ) );
</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() &amp;&amp; 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"> ?&gt;
</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' ) &amp;&amp; empty( $_REQUEST['nr'] ) )
</del><ins>+        if ( false === strpos( wp_get_referer(), 'wp-login.php' ) &amp;&amp; false === strpos( wp_get_referer(), 'activate' ) &amp;&amp; empty( $_REQUEST['nr'] ) )
</ins><span class="cx">                 return wp_get_referer();
</span><span class="cx"> 
</span><span class="cx">         return $bp-&gt;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() { ?&gt;
</span><span class="cx">         &lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;
</span><del>-                &lt;p&gt;&lt;?php printf( __( 'Theme activated! This theme contains &lt;a href=&quot;%s&quot;&gt;customization options&lt;/a&gt; and &lt;a href=&quot;%s&quot;&gt;custom header image&lt;/a&gt; support. &lt;a href=&quot;%s&quot;&gt;Sidebar widgets&lt;/a&gt; are also supported.', 'buddypress' ), admin_url( 'themes.php?page=theme-options-page' ), admin_url( 'themes.php?page=custom-header' ), admin_url( 'widgets.php' ) ) ?&gt;&lt;/p&gt;
</del><ins>+                &lt;p&gt;&lt;?php printf( __( 'Theme activated! This theme contains &lt;a href=&quot;%s&quot;&gt;custom header image&lt;/a&gt; support and &lt;a href=&quot;%s&quot;&gt;sidebar widgets&lt;/a&gt;.', 'buddypress' ), admin_url( 'themes.php?page=custom-header' ), admin_url( 'widgets.php' ) ) ?&gt;&lt;/p&gt;
</ins><span class="cx">         &lt;/div&gt;
</span><span class="cx"> 
</span><span class="cx">         &lt;style type=&quot;text/css&quot;&gt;#message2, #message0 { display: none; }&lt;/style&gt;
</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">                                 &lt;?php do_action( 'bp_before_activate_content' ) ?&gt;
</span><span class="cx"> 
</span><del>-                                &lt;p&gt;&lt;?php _e( 'Your account was activated successfully! You can now log in with the username and password you provided when you signed up.', 'buddypress' ) ?&gt;&lt;/p&gt;
</del><ins>+                                &lt;?php if ( isset( $_GET['e'] ) ) : ?&gt;
+                                        &lt;p&gt;&lt;?php _e( 'Your account was activated successfully! Your account details have been sent to you in a separate email.', 'buddypress' ) ?&gt;&lt;/p&gt;
+                                &lt;?php else : ?&gt;
+                                        &lt;p&gt;&lt;?php _e( 'Your account was activated successfully! You can now log in with the username and password you provided when you signed up.', 'buddypress' ) ?&gt;&lt;/p&gt;
+                                &lt;?php endif; ?&gt;
</ins><span class="cx"> 
</span><del>-
</del><span class="cx">                         &lt;?php else : ?&gt;
</span><span class="cx"> 
</span><span class="cx">                                 &lt;h3&gt;&lt;?php _e( 'Activate your Account', 'buddypress' ) ?&gt;&lt;/h3&gt;
</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-&gt;id . '_day'] ) &amp;&amp; $day != $_POST['field_' . $field-&gt;id . '_day'] ) {
-                                        if ( !empty( $_POST['field_' . $field-&gt;id . '_day'] ) )
</del><ins>+                                if ( !empty( $_POST['field_' . $field-&gt;id . '_day'] ) ) {
+                                        if ( $day != $_POST['field_' . $field-&gt;id . '_day'] )
</ins><span class="cx">                                                 $day = $_POST['field_' . $field-&gt;id . '_day'];
</span><span class="cx">                                 }
</span><span class="cx"> 
</span><del>-                                if ( isset( $_POST['field_' . $field-&gt;id . '_month'] ) &amp;&amp; $month != $_POST['field_' . $field-&gt;id . '_month'] ) {
-                                        if ( !empty( $_POST['field_' . $field-&gt;id . '_month'] ) )
</del><ins>+                                if ( !empty( $_POST['field_' . $field-&gt;id . '_month'] ) ) {
+                                        if ( $month != $_POST['field_' . $field-&gt;id . '_month'] )
</ins><span class="cx">                                                 $month = $_POST['field_' . $field-&gt;id . '_month'];
</span><span class="cx">                                 }
</span><span class="cx"> 
</span><del>-                                if ( isset( $_POST['field_' . $field-&gt;id . '_year'] ) &amp;&amp; $year != date(&quot;j&quot;, $_POST['field_' . $field-&gt;id . '_year'] ) ) {
-                                        if ( !empty( $_POST['field_' . $field-&gt;id . '_year'] ) )
</del><ins>+                                if ( !empty( $_POST['field_' . $field-&gt;id . '_year'] ) ) {
+                                        if ( $year != date( &quot;j&quot;, $_POST['field_' . $field-&gt;id . '_year'] ) )
</ins><span class="cx">                                                 $year = $_POST['field_' . $field-&gt;id . '_year'];
</span><span class="cx">                                 }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>