WordPress.org

Ready to get started?Download WordPress

Forums

Custom comment fields? Surprised there is little info (8 posts)

  1. dotnature
    Member
    Posted 6 years ago #

    One of the great features of wordpress is without any doubt the comment system, I was surprised to find no info on this site on how to customize the input fields for comments.
    Though it seems very possible to hack input feilds with database support Im not sure how well they would work with extensive plug-in use.
    I was also surprised to find no plug-ins that can add or change the comment fields.

    Maybe Im overlooking something, has anyone found a plug-in or some documentation that can enable this?

    For instance If I wanted to add a field called "country" to the comment form and have it a required field.

  2. Dgold
    Member
    Posted 6 years ago #

    that is a good idea

    I know you can hack your comment-form.php (filename is something like that). But I don't know of a plugin that helps with it.

    The only one I know that does something there is WP-Grins and Custom Smileys, which add a row of clickable emoticons in the Comment form. I know, that's not the same as adding another user-input field.

    By the way, there might be a plugin that Detects the country of the Commenter, and even puts a little flag showing their country and browser type. Seems like I have seen that. Again, not the same thing as a user-input field.

  3. dotnature
    Member
    Posted 6 years ago #

    Ya I can fairly easily hack my own input fields, but I hate doing that because it often messes with any upgrades or other useful plug-ins.

    The county was just an example, I am looking for a way to really alter comments by adding several custom fields and drop-downs, select buttons, etc. It can give a more personal look to the comments and provide some really nice info besides the usual plain comment field. Drupal does this rather well and Im currently using it for this setup, was surprised WP didnt have any flexability since its heavily into comments.

  4. narok119
    Member
    Posted 6 years ago #

    http://wphooks.flatearth.org/hooks/comment_form/

    This is the way you can add more field to the comment form.
    I hope this url is helpful for you.

  5. ythibodeau
    Member
    Posted 6 years ago #

    how is this helpful?

  6. bobacus
    Member
    Posted 6 years ago #

    Hi,

    I'm adding 2 fields to the comment form, which I'm doing with a combination of a custom theme and a custom plugin.

    The theme adds the two fields to the form, and the plugin adds a new database table, with comment_ID as the foreign key.

    The plugin hooks into the comment_post action to insert the custom field values into the database, and it also provides two template functions - one for each field - for echoing the values for the comment. These are called from the theme templates.

    The only thing left is validation. I want to force the users to fill these fields in (they are text fields). I suppose I could make them dropdowns instead, or use javascript validation, but it does need to work correctly without javascript, so ideally the PHP would detect if the fields are empty, and then abort the comment post entirely, prompting the user to fill in the fields.

    So to my question - how do I hook into the comment validation process?

    Rob

  7. ythibodeau
    Member
    Posted 6 years ago #

    Can you tell us how you've done this so far?
    Step by step? (tutorial)...

  8. Nabha
    Member
    Posted 6 years ago #

    This is a plugin which could help you add custom fields -- I haven't tried it totally myself, though:
    http://www.ideashower.com/solutions/wordpress-plugin-extra-comment-fields/

Topic Closed

This topic has been closed to new replies.

About this Topic