<!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] [1977] trunk:
  Xprofile fixes - default option radio button on field creation.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>1977</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2009-09-28 19:42:55 +0000 (Mon, 28 Sep 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Xprofile fixes - default option radio button on field creation. Disabling register page for logged in site admins as it causes problems. Datebox tweaks.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpcorebpcoresignupphp">trunk/bp-core/bp-core-signup.php</a></li>
<li><a href="#trunkbpxprofileadminjsadminjs">trunk/bp-xprofile/admin/js/admin.js</a></li>
<li><a href="#trunkbpxprofilebpxprofileclassesphp">trunk/bp-xprofile/bp-xprofile-classes.php</a></li>
<li><a href="#trunkbpxprofilebpxprofiletemplatetagsphp">trunk/bp-xprofile/bp-xprofile-templatetags.php</a></li>
<li><a href="#trunkbpxprofilephp">trunk/bp-xprofile.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpcorebpcoresignupphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-signup.php (1976 => 1977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-signup.php        2009-09-28 18:25:22 UTC (rev 1976)
+++ trunk/bp-core/bp-core-signup.php        2009-09-28 19:42:55 UTC (rev 1977)
</span><span class="lines">@@ -6,8 +6,8 @@
</span><span class="cx">         if ( $bp-&gt;current_component != BP_REGISTER_SLUG )
</span><span class="cx">                 return false;
</span><span class="cx">                 
</span><del>-        /* If the user is logged in, and is not a site admin, redirect away from here */
-        if ( is_user_logged_in() &amp;&amp; !is_site_admin() )
</del><ins>+        /* If the user is logged in, redirect away from here */
+        if ( is_user_logged_in() )
</ins><span class="cx">                 bp_core_redirect( $bp-&gt;root_domain );
</span><span class="cx">         
</span><span class="cx">         /***
</span><span class="lines">@@ -209,7 +209,7 @@
</span><span class="cx"> function bp_core_wpsignup_redirect() {
</span><span class="cx">         if ( false === strpos( $_SERVER['SCRIPT_NAME'], 'wp-signup.php') )
</span><span class="cx">                 return false;
</span><del>-                
</del><ins>+
</ins><span class="cx">         if ( '' != locate_template( array( 'registration/register.php' ), false ) || '' != locate_template( array( 'register.php' ), false ) )
</span><span class="cx">                 die;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkbpxprofileadminjsadminjs"></a>
<div class="modfile"><h4>Modified: trunk/bp-xprofile/admin/js/admin.js (1976 => 1977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-xprofile/admin/js/admin.js        2009-09-28 18:25:22 UTC (rev 1976)
+++ trunk/bp-xprofile/admin/js/admin.js        2009-09-28 19:42:55 UTC (rev 1977)
</span><span class="lines">@@ -27,7 +27,7 @@
</span><span class="cx">         }
</span><span class="cx">         
</span><span class="cx">         isDefault.setAttribute('value', theId);
</span><del>-
</del><ins>+        
</ins><span class="cx">         var label1 = document.createElement('label');
</span><span class="cx">         var txt1 = document.createTextNode(&quot; Default Value &quot;);
</span><span class="cx">         
</span></span></pre></div>
<a id="trunkbpxprofilebpxprofileclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-xprofile/bp-xprofile-classes.php (1976 => 1977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-xprofile/bp-xprofile-classes.php        2009-09-28 18:25:22 UTC (rev 1976)
+++ trunk/bp-xprofile/bp-xprofile-classes.php        2009-09-28 19:42:55 UTC (rev 1977)
</span><span class="lines">@@ -502,7 +502,7 @@
</span><span class="cx">                                 ?&gt;
</span><span class="cx">                                         
</span><span class="cx">                                         &lt;p&gt;&lt;?php _e('Option', 'buddypress') ?&gt; 1: &lt;input type=&quot;text&quot; name=&quot;&lt;?php echo $type ?&gt;_option[1]&quot; id=&quot;&lt;?php echo $type ?&gt;_option1&quot; /&gt;
</span><del>-                                        &lt;input type=&quot;&lt;?php echo $default_input ?&gt;&quot; name=&quot;isDefault_&lt;?php echo $type ?&gt;_option&lt;?php echo $default_name; ?&gt;&quot; id=&quot;isDefault_&lt;?php echo $type ?&gt;_option&quot; &lt;?php if ( $default_input == 'radio' ) {?&gt; checked=&quot;checked&quot;&lt;?php } ?&gt;&quot; value=&quot;1&quot; /&gt; &lt;?php _e( 'Default Value', 'buddypress' ) ?&gt;
</del><ins>+                                        &lt;input type=&quot;&lt;?php echo $default_input ?&gt;&quot; name=&quot;isDefault_&lt;?php echo $type ?&gt;_option&lt;?php echo $default_name; ?&gt;&quot; id=&quot;isDefault_&lt;?php echo $type ?&gt;_option&quot; value=&quot;1&quot; /&gt; &lt;?php _e( 'Default Value', 'buddypress' ) ?&gt;
</ins><span class="cx">                                         &lt;input type=&quot;hidden&quot; name=&quot;&lt;?php echo $type ?&gt;_option_number&quot; id=&quot;&lt;?php echo $type ?&gt;_option_number&quot; value=&quot;2&quot; /&gt;
</span><span class="cx">                                 
</span><span class="cx">                                 &lt;?php } // end if ?&gt;
</span></span></pre></div>
<a id="trunkbpxprofilebpxprofiletemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-xprofile/bp-xprofile-templatetags.php (1976 => 1977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-xprofile/bp-xprofile-templatetags.php        2009-09-28 18:25:22 UTC (rev 1976)
+++ trunk/bp-xprofile/bp-xprofile-templatetags.php        2009-09-28 19:42:55 UTC (rev 1977)
</span><span class="lines">@@ -470,30 +470,30 @@
</span><span class="cx">                                 break;
</span><span class="cx">                         
</span><span class="cx">                         case 'datebox':
</span><del>-                                
</del><ins>+                        
</ins><span class="cx">                                 if ( $field-&gt;data-&gt;value != '' ) {
</span><span class="cx">                                         $day = date(&quot;j&quot;, $field-&gt;data-&gt;value);
</span><span class="cx">                                         $month = date(&quot;F&quot;, $field-&gt;data-&gt;value);
</span><span class="cx">                                         $year = date(&quot;Y&quot;, $field-&gt;data-&gt;value);
</span><span class="cx">                                         $default_select = ' selected=&quot;selected&quot;';
</span><del>-                                        
-                                        /* Check for updated posted values, but errors preventing them from being saved first time */
-                                        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'] ) )
-                                                        $day = $_POST['field_' . $field-&gt;id . '_day'];
-                                        }
-                                        
-                                        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'] ) )
-                                                        $month = $_POST['field_' . $field-&gt;id . '_month'];
-                                        }
-                                        
-                                        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'] ) )
-                                                        $year = $_POST['field_' . $field-&gt;id . '_year'];
-                                        }
</del><span class="cx">                                 }
</span><span class="cx">                                 
</span><ins>+                                /* Check for updated posted values, but errors preventing them from being saved first time */
+                                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'] ) )
+                                                $day = $_POST['field_' . $field-&gt;id . '_day'];
+                                }
+                                
+                                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'] ) )
+                                                $month = $_POST['field_' . $field-&gt;id . '_month'];
+                                }
+                                
+                                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'] ) )
+                                                $year = $_POST['field_' . $field-&gt;id . '_year'];
+                                }
+                                
</ins><span class="cx">                                 switch ( $type ) {
</span><span class="cx">                                         case 'day':
</span><span class="cx">                                                 $html .= '&lt;option value=&quot;&quot;' . attribute_escape( $default_select ) . '&gt;--&lt;/option&gt;';
</span></span></pre></div>
<a id="trunkbpxprofilephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-xprofile.php (1976 => 1977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-xprofile.php        2009-09-28 18:25:22 UTC (rev 1976)
+++ trunk/bp-xprofile.php        2009-09-28 19:42:55 UTC (rev 1977)
</span><span class="lines">@@ -882,6 +882,9 @@
</span><span class="cx">         
</span><span class="cx">         if ( !$user_id )
</span><span class="cx">                 $user_id = $bp-&gt;displayed_user-&gt;id;
</span><ins>+        
+        if ( !$user_id )
+                return false;
</ins><span class="cx"> 
</span><span class="cx">         if ( is_numeric( $field ) )
</span><span class="cx">                 $field_id = $field;
</span><span class="lines">@@ -890,7 +893,7 @@
</span><span class="cx"> 
</span><span class="cx">         if ( !$field_id )
</span><span class="cx">                 return false;
</span><del>-                
</del><ins>+
</ins><span class="cx">         return apply_filters( 'xprofile_get_field_data', BP_XProfile_ProfileData::get_value_byid( $field_id, $user_id ) );
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>