<!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>[12267] trunk:
  Standardize on user_id instead of user_ID when passing comment data.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12267">12267</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2009-11-23 21:04:11 +0000 (Mon, 23 Nov 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Standardize on user_id instead of user_ID when passing comment data. fixes <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 (12266 => 12267)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-comments-post.php        2009-11-23 18:51:14 UTC (rev 12266)
+++ trunk/wp-comments-post.php        2009-11-23 21:04:11 UTC (rev 12267)
</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 (12266 => 12267)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/comment.php        2009-11-23 18:51:14 UTC (rev 12266)
+++ trunk/wp-includes/comment.php        2009-11-23 21:04:11 UTC (rev 12267)
</span><span class="lines">@@ -1076,7 +1076,11 @@
</span><span class="cx">  * @return array Parsed comment information.
</span><span class="cx">  */
</span><span class="cx"> function wp_filter_comment($commentdata) {
</span><del>-        $commentdata['user_id']              = apply_filters('pre_user_id', $commentdata['user_ID']);
</del><ins>+        // user_id is preferred. user_ID is accepted for back-compat.
+        if ( isset($commentdata['user_ID']) )
+                $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']);
</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">@@ -1127,7 +1131,11 @@
</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>-        $commentdata['user_ID']         = (int) $commentdata['user_ID'];
</del><ins>+        // user_id is preferred. user_ID is accepted for back-compat.
+        if ( isset($commentdata['user_ID']) )
+                $commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_ID'];
+        else
+                $commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_id'];
</ins><span class="cx"> 
</span><span class="cx">         $commentdata['comment_parent'] = absint($commentdata['comment_parent']);
</span><span class="cx">         $parent_status = ( 0 &lt; $commentdata['comment_parent'] ) ? wp_get_comment_status($commentdata['comment_parent']) : '';
</span><span class="lines">@@ -1153,7 +1161,7 @@
</span><span class="cx"> 
</span><span class="cx">                 $post = &amp;get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment
</span><span class="cx"> 
</span><del>-                if ( get_option('comments_notify') &amp;&amp; $commentdata['comment_approved'] &amp;&amp; $post-&gt;post_author != $commentdata['user_ID'] )
</del><ins>+                if ( get_option('comments_notify') &amp;&amp; $commentdata['comment_approved'] &amp;&amp; $post-&gt;post_author != $commentdata['user_id'] )
</ins><span class="cx">                         wp_notify_postauthor($comment_ID, $commentdata['comment_type']);
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpincludesuserphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/user.php (12266 => 12267)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/user.php        2009-11-23 18:51:14 UTC (rev 12266)
+++ trunk/wp-includes/user.php        2009-11-23 21:04:11 UTC (rev 12267)
</span><span class="lines">@@ -451,7 +451,7 @@
</span><span class="cx">  * @param int $user_id Optional. User ID to setup global data.
</span><span class="cx">  */
</span><span class="cx"> function setup_userdata($user_id = '') {
</span><del>-        global $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity;
</del><ins>+        global $user_login, $userdata, $user_level, $user_id, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity;
</ins><span class="cx"> 
</span><span class="cx">         if ( '' == $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        = (int) $user-&gt;ID;
</del><ins>+        $user_id = $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>