<!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>[12300] trunk: Accept either user_id or user_ID.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12300">12300</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2009-12-01 02:06:02 +0000 (Tue, 01 Dec 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Accept either user_id or user_ID. Remove user_id global. see <a href="http://trac.wordpress.org/ticket/11271">#11271</a> <a href="http://trac.wordpress.org/ticket/11222">#11222</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpcommentspostphp">trunk/wp-comments-post.php</a></li>
<li><a href="#trunkwpincludescommentphp">trunk/wp-includes/comment.php</a></li>
<li><a href="#trunkwpincludesuserphp">trunk/wp-includes/user.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpcommentspostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-comments-post.php (12299 => 12300)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-comments-post.php        2009-11-30 22:17:28 UTC (rev 12299)
+++ trunk/wp-comments-post.php        2009-12-01 02:06:02 UTC (rev 12300)
</span><span class="lines">@@ -75,7 +75,7 @@
</span><span class="cx"> 
</span><span class="cx"> $comment_parent = isset($_POST['comment_parent']) ? absint($_POST['comment_parent']) : 0;
</span><span class="cx"> 
</span><del>-$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_id');
</del><ins>+$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID');
</ins><span class="cx"> 
</span><span class="cx"> $comment_id = wp_new_comment( $commentdata );
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpincludescommentphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/comment.php (12299 => 12300)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/comment.php        2009-11-30 22:17:28 UTC (rev 12299)
+++ trunk/wp-includes/comment.php        2009-12-01 02:06:02 UTC (rev 12300)
</span><span class="lines">@@ -1126,11 +1126,10 @@
</span><span class="cx">  * @return array Parsed comment information.
</span><span class="cx">  */
</span><span class="cx"> function wp_filter_comment($commentdata) {
</span><del>-        // user_id is preferred. user_ID is accepted for back-compat.
</del><span class="cx">         if ( isset($commentdata['user_ID']) )
</span><del>-                $commentdata['user_id'] = $commentdata['user_ID'] = apply_filters('pre_user_id', $commentdata['user_ID']);
-        else
-                $commentdata['user_id'] = $commentdata['user_ID'] = apply_filters('pre_user_id', $commentdata['user_id']);
</del><ins>+                $commentdata['user_id'] = apply_filters('pre_user_id', $commentdata['user_ID']);
+        elseif ( isset($commentdata['user_id']) )
+                $commentdata['user_id'] = apply_filters('pre_user_id', $commentdata['user_id']);
</ins><span class="cx">         $commentdata['comment_agent']        = apply_filters('pre_comment_user_agent', $commentdata['comment_agent']);
</span><span class="cx">         $commentdata['comment_author']       = apply_filters('pre_comment_author_name', $commentdata['comment_author']);
</span><span class="cx">         $commentdata['comment_content']      = apply_filters('pre_comment_content', $commentdata['comment_content']);
</span><span class="lines">@@ -1181,11 +1180,10 @@
</span><span class="cx">         $commentdata = apply_filters('preprocess_comment', $commentdata);
</span><span class="cx"> 
</span><span class="cx">         $commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID'];
</span><del>-        // user_id is preferred. user_ID is accepted for back-compat.
</del><span class="cx">         if ( isset($commentdata['user_ID']) )
</span><span class="cx">                 $commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_ID'];
</span><del>-        else
-                $commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_id'];
</del><ins>+        elseif ( isset($commentdata['user_id']) )
+                $commentdata['user_id'] = (int) $commentdata['user_id'];
</ins><span class="cx"> 
</span><span class="cx">         $commentdata['comment_parent'] = isset($commentdata['comment_parent']) ? absint($commentdata['comment_parent']) : 0;
</span><span class="cx">         $parent_status = ( 0 &lt; $commentdata['comment_parent'] ) ? wp_get_comment_status($commentdata['comment_parent']) : '';
</span></span></pre></div>
<a id="trunkwpincludesuserphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/user.php (12299 => 12300)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/user.php        2009-11-30 22:17:28 UTC (rev 12299)
+++ trunk/wp-includes/user.php        2009-12-01 02:06:02 UTC (rev 12300)
</span><span class="lines">@@ -451,7 +451,7 @@
</span><span class="cx">  * @param int $for_user_id Optional. User ID to setup global data.
</span><span class="cx">  */
</span><span class="cx"> function setup_userdata($for_user_id = '') {
</span><del>-        global $user_login, $userdata, $user_level, $user_id, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity;
</del><ins>+        global $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity;
</ins><span class="cx"> 
</span><span class="cx">         if ( '' == $for_user_id )
</span><span class="cx">                 $user = wp_get_current_user();
</span><span class="lines">@@ -464,7 +464,7 @@
</span><span class="cx">         $userdata = $user-&gt;data;
</span><span class="cx">         $user_login        = $user-&gt;user_login;
</span><span class="cx">         $user_level        = (int) isset($user-&gt;user_level) ? $user-&gt;user_level : 0;
</span><del>-        $user_id = $user_ID = (int) $user-&gt;ID;
</del><ins>+        $user_ID = (int) $user-&gt;ID;
</ins><span class="cx">         $user_email        = $user-&gt;user_email;
</span><span class="cx">         $user_url        = $user-&gt;user_url;
</span><span class="cx">         $user_pass_md5        = md5($user-&gt;user_pass);
</span></span></pre>
</div>
</div>

</body>
</html>