<!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] [2831] branches/1.2: Fixes #2173</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>2831</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-03-11 11:41:31 +0000 (Thu, 11 Mar 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Fixes #2173</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branches12bpthemesbpdefault_inccssdefaultcss">branches/1.2/bp-themes/bp-default/_inc/css/default.css</a></li>
<li><a href="#branches12bpthemesbpdefault_incglobaljs">branches/1.2/bp-themes/bp-default/_inc/global.js</a></li>
<li><a href="#branches12bpthemesbpdefaultmemberssingleprofileeditphp">branches/1.2/bp-themes/bp-default/members/single/profile/edit.php</a></li>
<li><a href="#branches12bpxprofilebpxprofiletemplatetagsphp">branches/1.2/bp-xprofile/bp-xprofile-templatetags.php</a></li>
<li><a href="#branches12bpxprofilephp">branches/1.2/bp-xprofile.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branches12bpthemesbpdefault_inccssdefaultcss"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-themes/bp-default/_inc/css/default.css (2830 => 2831)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-themes/bp-default/_inc/css/default.css        2010-03-11 10:32:14 UTC (rev 2830)
+++ branches/1.2/bp-themes/bp-default/_inc/css/default.css        2010-03-11 11:41:31 UTC (rev 2831)
</span><span class="lines">@@ -802,6 +802,12 @@
</span><span class="cx">                         margin-bottom: 5px;
</span><span class="cx">                 }
</span><span class="cx">
</span><ins>+        form.standard-form a.clear-value {
+                display: block;
+                margin-top: 5px;
+                outline: none;
+        }
+
</ins><span class="cx"> form.standard-form #basic-details-section, form.standard-form #blog-details-section,
</span><span class="cx"> form.standard-form #profile-details-section {
</span><span class="cx">         float: left;
</span></span></pre></div>
<a id="branches12bpthemesbpdefault_incglobaljs"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-themes/bp-default/_inc/global.js (2830 => 2831)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-themes/bp-default/_inc/global.js        2010-03-11 10:32:14 UTC (rev 2830)
+++ branches/1.2/bp-themes/bp-default/_inc/global.js        2010-03-11 11:41:31 UTC (rev 2831)
</span><span class="lines">@@ -1225,10 +1225,16 @@
</span><span class="cx">
</span><span class="cx">         var container = document.getElementById(container);
</span><span class="cx">
</span><del>-        radioButtons = container.getElementsByTagName('INPUT');
</del><ins>+        if ( radioButtons = container.getElementsByTagName('INPUT') ) {
+                for(var i=0; i<radioButtons.length; i++) {
+                        radioButtons[i].checked = '';
+                }
+        }
</ins><span class="cx">
</span><del>-        for(var i=0; i<radioButtons.length; i++) {
-                radioButtons[i].checked = '';
</del><ins>+        if ( options = container.getElementsByTagName('OPTION') ) {
+                for(var i=0; i<options.length; i++) {
+                        options[i].selected = false;
+                }
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         return;
</span></span></pre></div>
<a id="branches12bpthemesbpdefaultmemberssingleprofileeditphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-themes/bp-default/members/single/profile/edit.php (2830 => 2831)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-themes/bp-default/members/single/profile/edit.php        2010-03-11 10:32:14 UTC (rev 2830)
+++ branches/1.2/bp-themes/bp-default/members/single/profile/edit.php        2010-03-11 11:41:31 UTC (rev 2831)
</span><span class="lines">@@ -48,6 +48,10 @@
</span><span class="cx">                                                 <?php bp_the_profile_field_options() ?>
</span><span class="cx">                                         </select>
</span><span class="cx">
</span><ins>+                                        <?php if ( !bp_get_the_profile_field_is_required() ) : ?>
+                                                <a class="clear-value" href="javascript:clear( '<?php bp_the_profile_field_input_name() ?>' );"><?php _e( 'Clear', 'buddypress' ) ?></a>
+                                        <?php endif; ?>
+
</ins><span class="cx">                                 <?php endif; ?>
</span><span class="cx">
</span><span class="cx">                                 <?php if ( 'radio' == bp_get_the_profile_field_type() ) : ?>
</span></span></pre></div>
<a id="branches12bpxprofilebpxprofiletemplatetagsphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-xprofile/bp-xprofile-templatetags.php (2830 => 2831)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-xprofile/bp-xprofile-templatetags.php        2010-03-11 10:32:14 UTC (rev 2830)
+++ branches/1.2/bp-xprofile/bp-xprofile-templatetags.php        2010-03-11 11:41:31 UTC (rev 2831)
</span><span class="lines">@@ -344,7 +344,11 @@
</span><span class="cx">         function bp_get_the_profile_field_input_name() {
</span><span class="cx">                 global $field;
</span><span class="cx">
</span><del>-                return apply_filters( 'bp_get_the_profile_field_input_name', 'field_' . $field->id );
</del><ins>+                $array_box = false;
+                if ( 'multiselectbox' == $field->type )
+                        $array_box = '[]';
+
+                return apply_filters( 'bp_get_the_profile_field_input_name', 'field_' . $field->id . $array_box );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx"> function bp_the_profile_field_options( $args = '' ) {
</span><span class="lines">@@ -372,15 +376,18 @@
</span><span class="cx">                                         $html .= '<option value="">--------</option>';
</span><span class="cx">
</span><span class="cx">                                 for ( $k = 0; $k < count($options); $k++ ) {
</span><del>-                                        $option_value = BP_XProfile_ProfileData::get_value_byid($options[$k]->parent_id);
</del><ins>+                                        $option_values = maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( $options[$k]->parent_id ) );
+                                        $option_values = (array)$option_values;
</ins><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] ) && $option_value != $_POST['field_' . $field->id] ) {
-                                                if ( !empty( $_POST['field_' . $field->id] ) )
-                                                        $option_value = $_POST['field_' . $field->id];
</del><ins>+                                        foreach( (array)$option_values as $i => $option_value ) {
+                                                if ( isset( $_POST['field_' . $field->id] ) && $_POST['field_' . $field->id] != $option_value ) {
+                                                        if ( !empty( $_POST['field_' . $field->id] ) )
+                                                                $option_values[$i] = $_POST['field_' . $field->id];
+                                                }
</ins><span class="cx">                                         }
</span><span class="cx">
</span><del>-                                        if ( $option_value == $options[$k]->name || $options[$k]->is_default_option ) {
</del><ins>+                                        if ( in_array( $options[$k]->name, (array)$option_values ) || $options[$k]->is_default_option ) {
</ins><span class="cx">                                                 $selected = ' selected="selected"';
</span><span class="cx">                                         } else {
</span><span class="cx">                                                 $selected = '';
</span></span></pre></div>
<a id="branches12bpxprofilephp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-xprofile.php (2830 => 2831)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-xprofile.php        2010-03-11 10:32:14 UTC (rev 2830)
+++ branches/1.2/bp-xprofile.php        2010-03-11 11:41:31 UTC (rev 2831)
</span><span class="lines">@@ -335,7 +335,7 @@
</span><span class="cx">                                         do_action( 'xprofile_profile_field_data_updated', $field_id, $_POST['field_' . $field_id] );
</span><span class="cx">                         }
</span><span class="cx">
</span><del>-                        do_action( 'xprofile_updated_profile', $posted_field_ids, $errors );
</del><ins>+                        do_action( 'xprofile_updated_profile', $bp->displayed_user->id, $posted_field_ids, $errors );
</ins><span class="cx">
</span><span class="cx">                         /* Set the feedback messages */
</span><span class="cx">                         if ( $errors )
</span></span></pre>
</div>
</div>
</body>
</html>