[wp-hackers] Proper action to hook to save custom fields with comments?

Ryan Bilesky rbilesky at gmail.com
Mon Sep 27 03:17:09 UTC 2010


try this

add_action ('comment_post', 'add_meta_settings', 1);

function add_meta_settings($comment_id) {
     add_comment_meta($comment_id, 'my_custom_stuff,
$_POST['my_custom_stuff], true);
}

On Sun, Sep 26, 2010 at 6:34 PM, Nathaniel Taintor <
goldenapplesdesign at gmail.com> wrote:

> Hi all,
>
> I'm getting stuck trying to add custom fields to a comment form and
> wondering if anyone else can point me in the right direction. I have a
> couple additional fields I need to add to the comment form.
>
> Since these fields need to show up for all users, whether logged in or not,
> I think I'm correct in understanding that I can't use the
> 'comment_form_default_fields' filter. As far as I can tell, these fields
> are
> only displayed for users who are not logged in.
>
> So instead I modified the 'comment_field' body in 'comment_form_defaults'
> to
> include my additional input fields. I haven't found an action hook or
> filter
> on saving comments that I can hook into to access these fields, though.
> I've
> tested 'edit_comment' and 'comment_save_pre', but I can't seem to access
> the
> POST data for my custom fields at either one of these. What am I dong
> wrong?
>
> Thanksn in advance,
>
> Nathaniel Taintor, Designer/Developer
> *Golden Apples Design*
>
> http://goldenapplesdesign.com
>
> @GoldenApples | 503.877.2880
> goldenapplesdesign at gmail.com
> _______________________________________________
> 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