[wp-trac] [WordPress Trac] #34997: preprocess_comment filter does not contain old user_ID field for user_id, instead it has new user_id field
WordPress Trac
noreply at wordpress.org
Fri Dec 11 19:36:45 UTC 2015
#34997: preprocess_comment filter does not contain old user_ID field for user_id,
instead it has new user_id field
-------------------------------------------+--------------------
Reporter: cookiesowns | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.4.1
Component: Comments | Version: 4.4
Severity: normal | Resolution:
Keywords: reporter-feedback needs-patch | Focuses:
-------------------------------------------+--------------------
Comment (by cookiesowns):
Indeed.
Given this code here...
{{{#!php
<?php
function filter_comments( $commentdata ) {
// This will fail due to new change
if($commentdata['user_ID']) {
// Do something with user
}
}
add_filter( 'preprocess_comment', 'filter_comments' );
}}}
That code above will break with the new code.
{{{#!php
<?php
function filter_comments( $commentdata ) {
// This is how we're supposed to filter comments now apparently..
if($commentdata['user_id']) {
// Do something with user
}
}
add_filter( 'preprocess_comment', 'filter_comments' );
}}}
Documentation has not yet been changed for this simple syntax change.
I'm thinking due to backwards compatibility, we might want to send both
user_ID and user_id ? Or should the documentation just be changed to
account for this?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34997#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list