<!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>[13329] trunk: Switch over to *_user_meta() syntax.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13329">13329</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2010-02-23 10:42:40 +0000 (Tue, 23 Feb 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Switch over to *_user_meta() syntax. The old get_usermeta() would return a string when only one value was found, get_user_meta() requires $single = true. Fixes <a href="http://trac.wordpress.org/ticket/10837">#10837</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesmsphp">trunk/wp-admin/includes/ms.php</a></li>
<li><a href="#trunkwpadminincludesupgradephp">trunk/wp-admin/includes/upgrade.php</a></li>
<li><a href="#trunkwpincludesmsfunctionsphp">trunk/wp-includes/ms-functions.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesmsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/ms.php (13328 => 13329)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/ms.php        2010-02-23 10:30:21 UTC (rev 13328)
+++ trunk/wp-admin/includes/ms.php        2010-02-23 10:42:40 UTC (rev 13329)
</span><span class="lines">@@ -543,12 +543,12 @@
</span><span class="cx"> 
</span><span class="cx">         if ( !empty( $blogs ) ) {
</span><span class="cx">                 foreach( $blogs as $blogid =&gt; $blog ) {
</span><del>-                        if ( $blogid != $dashboard_blog-&gt;blog_id &amp;&amp; get_user_meta( $current_user-&gt;ID , 'primary_blog' ) == $dashboard_blog-&gt;blog_id ) {
</del><ins>+                        if ( $blogid != $dashboard_blog-&gt;blog_id &amp;&amp; get_user_meta( $current_user-&gt;ID , 'primary_blog', true ) == $dashboard_blog-&gt;blog_id ) {
</ins><span class="cx">                                 update_user_meta( $current_user-&gt;ID, 'primary_blog', $blogid );
</span><span class="cx">                                 continue;
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><del>-                $blog = get_blog_details( get_user_meta( $current_user-&gt;ID , 'primary_blog' ) );
</del><ins>+                $blog = get_blog_details( get_user_meta( $current_user-&gt;ID, 'primary_blog', true ) );
</ins><span class="cx">                 $protocol = ( is_ssl() ? 'https://' : 'http://' );
</span><span class="cx">                 wp_redirect( $protocol . $blog-&gt;domain . $blog-&gt;path . 'wp-admin/?c=' . $c ); // redirect and count to 5, &quot;just in case&quot;
</span><span class="cx">                 exit;
</span><span class="lines">@@ -690,7 +690,7 @@
</span><span class="cx">                 &lt;td&gt;
</span><span class="cx">                 &lt;?php
</span><span class="cx">                 $all_blogs = get_blogs_of_user( $current_user-&gt;ID );
</span><del>-                $primary_blog = get_user_meta($current_user-&gt;ID, 'primary_blog');
</del><ins>+                $primary_blog = get_user_meta($current_user-&gt;ID, 'primary_blog', true);
</ins><span class="cx">                 if ( count( $all_blogs ) &gt; 1 ) {
</span><span class="cx">                         $found = false;
</span><span class="cx">                         ?&gt;
</span></span></pre></div>
<a id="trunkwpadminincludesupgradephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/upgrade.php (13328 => 13329)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/upgrade.php        2010-02-23 10:30:21 UTC (rev 13328)
+++ trunk/wp-admin/includes/upgrade.php        2010-02-23 10:42:40 UTC (rev 13329)
</span><span class="lines">@@ -704,7 +704,7 @@
</span><span class="cx">                 // FIXME: RESET_CAPS is temporary code to reset roles and caps if flag is set.
</span><span class="cx">                 $caps = get_user_meta( $user-&gt;ID, $wpdb-&gt;prefix . 'capabilities');
</span><span class="cx">                 if ( empty($caps) || defined('RESET_CAPS') ) {
</span><del>-                        $level = get_user_meta($user-&gt;ID, $wpdb-&gt;prefix . 'user_level');
</del><ins>+                        $level = get_user_meta($user-&gt;ID, $wpdb-&gt;prefix . 'user_level', true);
</ins><span class="cx">                         $role = translate_level_to_role($level);
</span><span class="cx">                         update_user_meta( $user-&gt;ID, $wpdb-&gt;prefix . 'capabilities', array($role =&gt; true) );
</span><span class="cx">                 }
</span></span></pre></div>
<a id="trunkwpincludesmsfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/ms-functions.php (13328 => 13329)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/ms-functions.php        2010-02-23 10:30:21 UTC (rev 13328)
+++ trunk/wp-includes/ms-functions.php        2010-02-23 10:42:40 UTC (rev 13329)
</span><span class="lines">@@ -82,7 +82,7 @@
</span><span class="cx">                 return $details;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        $primary_blog = get_user_meta( $user_id, &quot;primary_blog&quot; );
</del><ins>+        $primary_blog = get_user_meta( $user_id, 'primary_blog', true );
</ins><span class="cx">         $details = get_dashboard_blog();
</span><span class="cx">         if ( $primary_blog ) {
</span><span class="cx">                 $blogs = get_blogs_of_user( $user_id );
</span><span class="lines">@@ -109,11 +109,11 @@
</span><span class="cx">                                 if ( is_object( $details ) &amp;&amp; $details-&gt;archived == 0 &amp;&amp; $details-&gt;spam == 0 &amp;&amp; $details-&gt;deleted == 0 ) {
</span><span class="cx">                                         $ret = $blog;
</span><span class="cx">                                         $changed = false;
</span><del>-                                        if ( get_user_meta( $user_id , 'primary_blog' ) != $blog_id ) {
</del><ins>+                                        if ( get_user_meta( $user_id , 'primary_blog', true ) != $blog_id ) {
</ins><span class="cx">                                                 update_user_meta( $user_id, 'primary_blog', $blog_id );
</span><span class="cx">                                                 $changed = true;
</span><span class="cx">                                         }
</span><del>-                                        if ( !get_user_meta($user_id , 'source_domain') ) {
</del><ins>+                                        if ( !get_user_meta($user_id , 'source_domain', true) ) {
</ins><span class="cx">                                                 update_user_meta( $user_id, 'source_domain', $blog-&gt;domain );
</span><span class="cx">                                                 $changed = true;
</span><span class="cx">                                         }
</span><span class="lines">@@ -248,7 +248,7 @@
</span><span class="cx">         if ( empty($user) )
</span><span class="cx">                 return new WP_Error('user_does_not_exist', __('That user does not exist.'));
</span><span class="cx"> 
</span><del>-        if ( !get_user_meta($user_id, 'primary_blog') ) {
</del><ins>+        if ( !get_user_meta($user_id, 'primary_blog', true) ) {
</ins><span class="cx">                 update_user_meta($user_id, 'primary_blog', $blog_id);
</span><span class="cx">                 $details = get_blog_details($blog_id);
</span><span class="cx">                 update_user_meta($user_id, 'source_domain', $details-&gt;domain);
</span><span class="lines">@@ -270,7 +270,7 @@
</span><span class="cx"> 
</span><span class="cx">         // If being removed from the primary blog, set a new primary if the user is assigned
</span><span class="cx">         // to multiple blogs.
</span><del>-        $primary_blog = get_user_meta($user_id, 'primary_blog');
</del><ins>+        $primary_blog = get_user_meta($user_id, 'primary_blog', true);
</ins><span class="cx">         if ( $primary_blog == $blog_id ) {
</span><span class="cx">                 $new_id = '';
</span><span class="cx">                 $new_domain = '';
</span><span class="lines">@@ -826,7 +826,7 @@
</span><span class="cx">         add_option( 'WPLANG', get_site_option( 'WPLANG' ) );
</span><span class="cx">         update_option( 'blog_public', $meta['public'] );
</span><span class="cx"> 
</span><del>-        if ( !is_super_admin() &amp;&amp; get_user_meta( $user_id, 'primary_blog' ) == get_site_option( 'dashboard_blog', 1 ) )
</del><ins>+        if ( !is_super_admin() &amp;&amp; get_user_meta( $user_id, 'primary_blog', true ) == get_site_option( 'dashboard_blog', 1 ) )
</ins><span class="cx">                 update_user_meta( $user_id, 'primary_blog', $blog_id );
</span><span class="cx"> 
</span><span class="cx">         restore_current_blog();
</span></span></pre>
</div>
</div>

</body>
</html>