• I’m not sure where to put this but within the past couple of point releases, something has changed in the comment handling. I see there have been some minor changes to the base code in /wp-includes/comment.php but I don’t see how it’s created the condition I am experiencing.

    I have a custom function that’s been running for several years without issue that hooks into the preprocess_comment filter hook to read the comment_author_email value in $commentdata. The function had filtered and set the $commentdata[‘user_id’] value and passed is back for processing by wp_new_comment(). The custom function runs after Akismet first handles the comment and is still functioning properly. However, something is butting in and resetting $commentdata[‘user_id’] to 0 before it gets to wp_insert_comment(). The only thing I could figure was something was hooking into the filters in wp_filter_comment() but it could only be Akismet. Akismet has become so complicated that I can’t tell if it’s actually manipulating other key=>value pairs $commentdata. I don’t have any other plugins that handle comments.

    Anyway, I fixed the behavior by having the custom function set both $commentdata[‘user_id’] AND the seemingly deprecated $commentdata[‘user_ID’] with the same value.

    The core code has several ternary operators that deal with the backwards compatibility to handle $commentdata[‘user_ID’] in several functions, including wp_new_comment() and wp_insert_comment().

    Anyway, I thought I would post this in case someone experiences similar variances in comment handling.

Viewing 1 replies (of 1 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Can’t be Akismet doing it. I can’t find any code in it to modify the comment in that manner.

    Akismet actually only works with user_ID, but all it does with that is to get the user role info for that user ID to pass to the servers for processing.

Viewing 1 replies (of 1 total)
  • The topic ‘Changing $commentdata’ is closed to new replies.