The MU forums have moved to WordPress.org

comment_post hook arguments. (3 posts)

  1. horrorshow
    Member
    Posted 16 years ago #

    Looking at wp_new_comment()
    do_action('comment_post',
    $comment_ID,$commentdata['comment_approved']);

    It passes $commentdata['comment_approved'], not the entire $commentdata.

    I am considering changing it so that it also passes $commentdata as the third parameter. This way, my plugin would not have to query the database for the info.

    I know it's sort of an argument of efficiency vs. (good style, code manageability)

    I don't think this would break any other plugins that would use the 'comment_post' hook, since I am adding a third argument. If the plugin doesn't know about it, then it'll just ignore it.

    I know I'll have to make this changes in comment.php on every upgrade that I do, but I can live with that.

    Do you see any other disadvantages of doing this?

    thanks for your wisdom.

  2. MrBrian
    Member
    Posted 16 years ago #

    Couldn't you get the rest of the comment data using the comment ID that is supplied?

  3. horrorshow
    Member
    Posted 16 years ago #

    Yes, but as I said, that would be an additional query when all the data that I need is already in $commentdata.

About this Topic

  • Started 16 years ago by horrorshow
  • Latest reply from horrorshow