<!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] [3270] branches/1.2/bp-xprofile:
Clean up HTML in xprofile admin area.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>3270</dd>
<dt>Author</dt> <dd>johnjamesjacoby</dd>
<dt>Date</dt> <dd>2010-09-17 18:07:07 +0000 (Fri, 17 Sep 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Clean up HTML in xprofile admin area. Add maybe_unserialize to get_value_byid. Fixes #2637.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branches12bpxprofilebpxprofileclassesphp">branches/1.2/bp-xprofile/bp-xprofile-classes.php</a></li>
<li><a href="#branches12bpxprofilebpxprofiletemplatetagsphp">branches/1.2/bp-xprofile/bp-xprofile-templatetags.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branches12bpxprofilebpxprofileclassesphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-xprofile/bp-xprofile-classes.php (3269 => 3270)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-xprofile/bp-xprofile-classes.php        2010-09-13 23:13:20 UTC (rev 3269)
+++ branches/1.2/bp-xprofile/bp-xprofile-classes.php        2010-09-17 18:07:07 UTC (rev 3270)
</span><span class="lines">@@ -482,15 +482,14 @@
</span><span class="cx">                 //This function populates the items for radio buttons checkboxes and drop down boxes
</span><span class="cx">                 $input_types = array( 'checkbox', 'selectbox', 'multiselectbox', 'radio' );
</span><span class="cx">
</span><del>-                foreach ($input_types as $type) {
</del><ins>+                foreach ( $input_types as $type ) {
</ins><span class="cx">                         $default_name = '';
</span><span class="cx">
</span><del>-                        if ( 'multiselectbox' == $type || 'checkbox' == $type ) {
</del><ins>+                        if ( 'multiselectbox' == $type || 'checkbox' == $type )
</ins><span class="cx">                                 $default_input = 'checkbox';
</span><del>-                        } else {
-                                $default_input = 'radio';
-                        }
-                ?>
</del><ins>+                        else
+                                $default_input = 'radio'; ?>
+
</ins><span class="cx">                         <div id="<?php echo $type ?>" class="options-box" style="<?php if ( $this->type != $type ) { ?>display: none;<?php } ?> margin-left: 15px;">
</span><span class="cx">                                 <h4><?php _e('Please enter options for this Field:', 'buddypress') ?></h4>
</span><span class="cx">                                 <p><?php _e( 'Order By:', 'buddypress' ) ?>
</span><span class="lines">@@ -519,33 +518,41 @@
</span><span class="cx">                                         }
</span><span class="cx">                                 }
</span><span class="cx">
</span><del>-                                if ( !empty($options) ) {
-                                        for ( $i = 0; $i < count($options); $i++ ) {
</del><ins>+                                if ( !empty( $options ) ) {
+                                        for ( $i = 0; $i < count( $options ); $i++ ) {
</ins><span class="cx">                                                 $j = $i + 1;
</span><span class="cx">
</span><span class="cx">                                                 if ( 'multiselectbox' == $type || 'checkbox' == $type )
</span><del>-                                                        $default_name = '[' . $j . ']';
-                                        ?>
-                                                <p><?php _e('Option', 'buddypress') ?> <?php echo $j ?>:
-                                                 <input type="text" name="<?php echo $type ?>_option[<?php echo $j ?>]" id="<?php echo $type ?>_option<?php echo $j ?>" value="<?php echo esc_attr( $options[$i]->name ) ?>" />
-                                                 <input type="<?php echo $default_input ?>" name="isDefault_<?php echo $type ?>_option<?php echo $default_name ?>" <?php if ( (int) $options[$i]->is_default_option ) {?> checked="checked"<?php } ?> " value="<?php echo $j ?>" /> <?php _e( 'Default Value', 'buddypress' ) ?>
-                                                        <?php if ( $j != 1 &&
-                                                                $options[$i]->id != -1 ) : ?><a href="admin.php?page=bp-profile-setup&amp;mode=delete_option&amp;option_id=<?php echo $options[$i]->id ?>" class="ajax-option-delete" id="delete-<?php echo $options[$i]->id ?>">[x]</a><?php endif ?></p>
</del><ins>+                                                        $default_name = '[' . $j . ']'; ?>
+
+                                                <p>
+                                                        <?php _e('Option', 'buddypress') ?> <?php echo $j ?>:
+                                                        <input type="text" name="<?php echo $type ?>_option[<?php echo $j ?>]" id="<?php echo $type ?>_option<?php echo $j ?>" value="<?php echo esc_attr( $options[$i]->name ) ?>" />
+                                                        <input type="<?php echo $default_input ?>" name="isDefault_<?php echo $type ?>_option<?php echo $default_name ?>" <?php if ( (int) $options[$i]->is_default_option ) {?> checked="checked"<?php } ?> value="<?php echo $j ?>" /> <?php _e( 'Default Value', 'buddypress' ) ?>
+
+                                                        <?php if ( $j != 1 && $options[$i]->id != -1 ) : ?>
+
+                                                                 <a href="admin.php?page=bp-profile-setup&amp;mode=delete_option&amp;option_id=<?php echo $options[$i]->id ?>" class="ajax-option-delete" id="delete-<?php echo $options[$i]->id ?>">[x]</a>
+
+                                                        <?php endif ?>
+
</ins><span class="cx">                                                 </p>
</span><ins>+
</ins><span class="cx">                                         <?php } // end for ?>
</span><ins>+
</ins><span class="cx">                                         <input type="hidden" name="<?php echo $type ?>_option_number" id="<?php echo $type ?>_option_number" value="<?php echo $j + 1 ?>" />
</span><span class="cx">
</span><span class="cx">                                 <?php
</span><span class="cx">                                 } else {
</span><span class="cx">                                         if ( 'multiselectbox' == $type || 'checkbox' == $type )
</span><del>-                                                $default_name = '[1]';
-                                ?>
</del><ins>+                                                $default_name = '[1]'; ?>
</ins><span class="cx">
</span><span class="cx">                                         <p><?php _e('Option', 'buddypress') ?> 1: <input type="text" name="<?php echo $type ?>_option[1]" id="<?php echo $type ?>_option1" />
</span><span class="cx">                                         <input type="<?php echo $default_input ?>" name="isDefault_<?php echo $type ?>_option<?php echo $default_name; ?>" id="isDefault_<?php echo $type ?>_option" value="1" /> <?php _e( 'Default Value', 'buddypress' ) ?>
</span><span class="cx">                                         <input type="hidden" name="<?php echo $type ?>_option_number" id="<?php echo $type ?>_option_number" value="2" />
</span><span class="cx">
</span><span class="cx">                                 <?php } // end if ?>
</span><ins>+
</ins><span class="cx">                                 <div id="<?php echo $type ?>_more"></div>
</span><span class="cx">                                 <p><a href="javascript:add_option('<?php echo $type ?>')"><?php _e('Add Another Option', 'buddypress') ?></a></p>
</span><span class="cx">                         </div>
</span><span class="lines">@@ -626,6 +633,8 @@
</span><span class="cx">                                                  <?php _e('or', 'buddypress') ?> <a href="admin.php?page=bp-profile-setup" style="color: red"><?php _e( 'Cancel', 'buddypress' ) ?></a>
</span><span class="cx">                                 </p>
</span><span class="cx">
</span><ins>+                        </div>
+
</ins><span class="cx">                         <div class="clear"></div>
</span><span class="cx">
</span><span class="cx">                         <?php if ( function_exists('wp_nonce_field') )
</span><span class="lines">@@ -799,10 +808,11 @@
</span><span class="cx">                 if ( is_array( $user_ids ) ) {
</span><span class="cx">                         $user_ids = implode( ',', (array)$user_ids );
</span><span class="cx">                         $data = $wpdb->get_results( $wpdb->prepare( "SELECT user_id, value FROM {$bp->profile->table_name_data} WHERE field_id = %d AND user_id IN ({$user_ids})", $field_id ) );
</span><del>-                } else
</del><ins>+                } else {
</ins><span class="cx">                         $data = $wpdb->get_var( $wpdb->prepare( "SELECT value FROM {$bp->profile->table_name_data} WHERE field_id = %d AND user_id = %d", $field_id, $user_ids ) );
</span><ins>+                }
</ins><span class="cx">
</span><del>-                return $data;
</del><ins>+                return maybe_unserialize( $data );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function get_value_byfieldname( $fields, $user_id = null ) {
</span></span></pre></div>
<a id="branches12bpxprofilebpxprofiletemplatetagsphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-xprofile/bp-xprofile-templatetags.php (3269 => 3270)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-xprofile/bp-xprofile-templatetags.php        2010-09-13 23:13:20 UTC (rev 3269)
+++ branches/1.2/bp-xprofile/bp-xprofile-templatetags.php        2010-09-17 18:07:07 UTC (rev 3270)
</span><span class="lines">@@ -376,7 +376,7 @@
</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_values = maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( $options[$k]->parent_id ) );
</del><ins>+                                        $option_values = BP_XProfile_ProfileData::get_value_byid( $options[$k]->parent_id );
</ins><span class="cx">                                         $option_values = (array)$option_values;
</span><span class="cx">
</span><span class="cx">                                         /* Check for updated posted values, but errors preventing them from being saved first time */
</span></span></pre>
</div>
</div>
</body>
</html>