[wp-hackers] Modifying wp-comments-post.php to accept new custom fields

DD32 wordpress at dd32.id.au
Wed Sep 24 02:01:04 GMT 2008


rather than modifying core files, you should probably use the  
'preprocess_comment' filter inside wp_new_comment() and check for a $_POST  
variable that you've added

However:
compact() takes a list of variables and compacts them into an array, As  
well as adding to that line, you need to also add the actual variable, eg,  
something similar to:
$comment_author_url   = trim($_POST['url']);
$comment_content      = trim($_POST['comment']);

So i miught use
$d_plugin = trim($_POST['d_plugin']);

compact('comment_post_ID', ...., 'd_plugin');

On Wed, 24 Sep 2008 11:53:47 +1000, MLR <mlrichard at gmail.com> wrote:

> Hi,
>
> I have created new columns in wp_comments and new input fields in a blog  
> to
> gather more data along with the comments (Gender, Age, etc.)
>
> I have modified wp-comments-post.php to gather these new POST variables  
> and
> added the column names to  the $commentdata = compact() line
>
> Currently my mods are not causing an error but obviously the new fields  
> are
> empty on save.
>
> What else should I tweak beyond that? I have looked in the Codex and on  
> the
> Web for an answer but the search results are overwhelmed with generic
> unrelated info.
>
> Thanks for pointing me in the right direction,
>
> Marie-Lynn
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>




More information about the wp-hackers mailing list