Home  »  Solutions  »  Wordpress Plugin: Extra Comment Fields
Preview of Wordpress Plugin: Extra Comment Fields

Wordpress Plugin: Extra Comment Fields

Nate Weiner - Posted in Solutions, , , Comments (191) - Download

Overview

This Wordpress plugin allows you to add additional fields for users to complete when submitting a comment. The extra data will be saved in the wp database and can be retrieved when showing a post’s list of comments.

The extra comment variables will show up in the list of comments in your Wordpress admin and are editable through the standard admin comment edit page.

This plugin requires a basic knowledge of HTML to modify your comment form.

Jump to Download

Example of Use

For this example, we are going to add a field asking for a users age to the comments form.

1. First, add the field to your comments form.

Typically your comments form is in your theme folder and is comments.php
Most likely: (/wp-content/themes/YOURTHEME/comments.php)

Enter the HTML of your new field into the desired spot. To add a textfield for the user to enter their age into, you would add the following to your form. I’ll add mine right below the url textfield.

<p><input type="text" name="age" id="age" size="22" />
<label for="url"><small>Website</small></label></p>

Screenshot of Adding Field

2. Next, we need to add the field-variable to Wordpress.

Inside your Wordpress admin, click the ‘Settings’ menu. Then click the ‘Extra Comment Fields’ menu.

Next, enter the name of the field. This has to be the exact name attribute you gave to the field you added to your comments form. For example, I added this field to my form:

<p><input type="text" name="age" id="age" size="22" />
<label for="url"><small>Website</small></label></p>

The input’s name attribute is ‘age’, so the variable you would enter for this field is ‘age‘.

Note: This can only contain letters, numbers, and/or dashes.

3. Last we want to make use of the data somehow when showing comments.

Your extra fields will be in the $comments variable retrieved by Wordpress. The extra fields you added will have a prefix of ‘extra_’. So to access the data for our ‘age‘ field, we use $comment->extra_age inside the comments loop.

So, for example, if I modify the default theme’s comment.php file, I just insert one line to display the extra comment information (highlighted in bold).

<ol class=”commentlist”>

<?php foreach ($comments as $comment) : ?>

<li <?php echo $oddcomment; ?>id=”comment-<?php comment_ID() ?>”>
<?php echo get_avatar( $comment, 32 ); ?>
<cite><?php comment_author_link() ?></cite> Says:
<?php if ($comment->comment_approved == ‘0′) : ?>
<em>Your comment is awaiting moderation.</em>
<?php endif; ?>
<br />

<small class=”commentmetadata”><a href=”#comment-<?php comment_ID() ?>” title=”"><?php comment_date(’F jS, Y’) ?> at <?php comment_time() ?></a> <?php edit_comment_link(’edit’,’ ‘,”); ?></small>

<?php comment_text() ?>
User’s Age is: <?php print $comment->extra_age; ?>

</li>

<?php
/* Changes every other comment to a different class */
$oddcomment = ( empty( $oddcomment ) ) ? ‘class=”alt” ‘ : ”;
?>

<?php endforeach; /* end for each comment */ ?>

</ol>

Another Example Posted on Problogger

How I added the Twitter ID field to comments on Twitip.com

Version History

1.2 - June 23rd, 2008

  • Corrected behavior when deleting/changing status of comment

1.1 Alpha - May 20th. 2008

  • Fixed blank comment content field

1.0 Beta - May 4th, 2008

  • Updated for WP 2.5
  • Added ability to edit comments
  • Added ability to view comments in admin
  • Extra Comments data deleted when comment is deleted
  • Fixed database table prefix

0.2 Alpha - Sept. 2007

  • Initial Release

Download

NOTE: I am no longer developing this plugin.  If you’d like to continue it, please consider it open source.  If you release a new version, update users in the comments below.  Thanks

Download the Extra Comment Fields Wordpress Plugin version 1.2 Beta
(For Wordpress 2.5+)

Download the Extra Comment Fields Wordpress Plugin version 0.2 Alpha
(Only for Wordpress 2.0 - 2.3)

To install, unzip the files into your /wp- content/plugins/ folder. Then activate it under the Plugin menu in your Wordpress admin.

Important Note When Upgrading from 0.2 to 1

If your Wordpress database tables do not start with ‘wp_’, you will likely need to rename the wp_comments_extra table in your database to match the other table’s prefix. This is a result of the first version incorrectly assuming the prefix across all installations.

For example, if you have have tables named called prefix_posts, prefix_comments, prefix_options, etc then you should rename the wp_comments_extra table to prefix_comments_extra.

Comments (191)


  1. Nice! I’ve been looking for something like this for a while.

    November 30th, 1999 Mikel
  2. Using WP 2.3, I see this error after Activating the plugin and navigating to the options page to configure it:

    WordPress database error: [Table 'waywardpress.wp_comments_extra' doesn't exist]
    SHOW COLUMNS FROM `wp_comments_extra`

    Seems that the install/activation isn’t creating the tables correctly, possibly due to an incompatibility with 2.3?

    October 12th, 2007 Jason
  3. Hey Jason, I will take a look at this tonight and get it fixed. In the meantime, if you can access your WP database and run queries on it, run:

    CREATE TABLE `wp_comments_extra` (
    `comment_id` BIGINT NOT NULL ,
    PRIMARY KEY ( `comment_id` )
    )

    This will create the table and should fix the problem on your end for now.

    October 12th, 2007 Nate Weiner
  4. Thanks Nate! No rush on my end. I am just testing to see if I can customize your plugin for a more robust solution to add in additional free text fields in comment forms. I just figured you’d like the feedback on my initial experience since I am not sure if you have tested on WP2.3 yet.

    October 12th, 2007 Jason
  5. Jason, I’ve corrected the problem, please download version 0.15 Thanks again.

    October 13th, 2007 Nate Weiner
  6. This worked great — thank you for making the plugin.

    To make the field I added a required one, I edited wp_comments_post, and that seemed to work fine.

    Thanks for your good work!

    October 16th, 2007 Nabha
  7. I downloaded the plugin today and am getting a similar error as Jason, above, when I try to add a new field in the admin:

    WordPress database error: [Table 'x.wp_accmecomments_extra' doesn't exist]
    ALTER TABLE `wp_accmecomments_extra` ADD `type` TEXT NOT NULL ;

    I tried running the query you posted, but got this back:

    Documentation
    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ”wp_comments_extra’ (’comment_id’ BIGINT NOT NULL, PRIMARY KEY (’comment_id’))’ at line 1

    This doesn’t occur in the version of WordPress I have installed on my local machine. Everything works smoothly there. Any ideas? Let me know if there’s other configuration info that would be helpful. Thanks.

    October 19th, 2007 Todd Prouty
  8. Todd, I’ve fixed this issue and uploaded a new version, download it and let me know if you have any further issues.
    Thanks!

    October 23rd, 2007 Nate Weiner
  9. I compared the new version (0.2) with the old (0.15) and I think the change is going in the wrong direction. You replaced $sql = "ALTER TABLE `".$wpdb->prefix."comments_extra` ADD `".$_POST['new_var'].”` TEXT NOT NULL ;”;
    with $sql = "ALTER TABLE `wp_comments_extra` ADD `".$_POST['new_var'].”` TEXT NOT NULL ;”;. The problem I was having ended up being caused by your hard-coding of the database prefix, “wp_”. Media Temple’s one-click installer for WP uses “wp_sitename” as the prefix, which breaks the plugin. Using that prefix variable is probably the right idea, but it would need to be used throughout the plugin. Replacing all the instances of “wp_” with the prefix used in my database fixed it for now.

    If anyone is getting similar errors but doesn’t know what their table prefix is, look it up in wp-config.php.

    October 23rd, 2007 Todd Prouty
  10. hi

    your plugin works fine on my English blog, thank you. But it messed up on the Russian blog. I use the plugin to add “city” field to the comments.

    The plugin worked okay initially but now all comments display the same country. I deactivated-reactivated the plugin - same result. It possibly has to do with using dashes in the additional field, as both times the replicated city name contained a dash. Please drop me an email if you solve that.

    November 8th, 2007 Alex
  11. This plugin looks very interesting thanks, though could you explain further how to access the data from $comment->extra_type (where to put it, or an example perhaps)

    November 9th, 2007 Ed
  12. Yet another useful idea, thanks

    November 10th, 2007 bLuefRogX
  13. I was having trouble getting the extra field to display (using echo “$comments->extra_[fieldname]“) and found out that ecf_getComments wasn’t running.

    More research showed that comments_array isn’t listed as one of the actions on the current Wordpress API:
    http://codex.wordpress.org/Plugin_API/Action_Reference

    I fixed this by adding a line to comments.php immediately after:
    if ($comments) :

    The line I added is:
    ecf_getComments($comments, $id);

    I hope that helps someone. I am totally new to the plugin API, and actions, and so on, and couldn’t find a better way to fix things.

    Everything works great now.

    November 15th, 2007 Nabha
  14. hi

    After some initial troubles, I managed to make your plugin work, but two issues remain:

    I’m using the plugi for “country” field and it shows the previous entry. That is, if someone is making a comment, his “country” field is pre-filled with the country of previous commenter.

    Also, activating the plugin creates an empty comment always on top. That is, the last comment is always empty. Clicking on Edit produces “no such comment message.”

    I’m running wp 2.2.1

    November 26th, 2007 Alex
  15. I would love to use your plugin, and I was able t add an extra field to the comment form and it is stored in the db, but I have can’t find out how to show the field in the comment *sigh*

    December 7th, 2007 gekow
  16. Oh, and is there a chance to see (and edit) the custom fields in the admin edit comment screen?

    gekow

    December 7th, 2007 gekow
  17. No support so far? I mean it’s nice to have my comments approved, but it would be better to have them answered :)

    December 10th, 2007 gekow
  18. Gekow,

    Just wanted to update you on the status of things at the Idea Shower, like the Wordpress Extra Comments Plugin.

    I’m in my last week of my current job. I’ve left that position to dedicate more time to Idea Shower and contract work. Things will be busy (and therefore slow) over the next couple of weeks but in January, once the dust has settled, you can expect many updates and releases (including some for Read It Later).

    I’m doing my best to keep the updates rolling, and soon I’ll be able to keep up with them. I appreciate the support and hope to get you guys updates soon.

    With that said, can you send me the code you are currently using to output your comments? And give me a description of where you’d like them to appear alongside the other information, I can then show you where to put them.

    Thanks!

    Nate

    December 10th, 2007 Nate Weiner
  19. Like others, I have now spent many hours simply trying to the the extra fields to show up in my comments… It appears that the comments loop does not recognize the “comments->extra_”myfield”… Actually it appears that the entire “extra_fields” table is invisible to the loop…

    I am simply trying to show a City, State, Country attribute on each post on my wishes pages… The form is working and the table is populated… I have tried “echo”, “print” and creating functions all to no avail…

    I am certain that there is a simple/obvious solution that I am missing.

    Can you share a successful implementation of this plug-in so that I can understand what I am missing? I am so close I can taste it!

    Thanks in advance!

    December 11th, 2007 hhempel
  20. @hhempel:

    You’re using comments->extra_myfield, when it should be comment->extra_myfield (no `s` at the end of ‘comment’) while recursing through the comments array.

    I’ve added an example above under #3.

    Does that help?

    December 11th, 2007 Nate Weiner
  21. Hi Nate,

    I am so impressed with the fast response and I really appreciate it! Truth is that I am still a bit lost (partially due to the fact that I am at the hairy end of my technical know-how rope)…

    I tried both the comments->extra_myfield (w/o the “s”) and the comment->extra_myfield (with the “s”) previously and failed to mention it… Sorry… I wish it were that easy. I am either failing to get the php syntax correct or I am failing to “connect” the “extra field” table to the code…

    Maybe you can answer 3 questions to set me straight:
    1) Can I call the extra comment field directly from the DB without the use of a function? (ie: print comment->extra_commentcity;) ?
    2) How does the php code know to look in a different table when the bulk of the functions being called in the template are coming from the standard comments table?
    3) Do I need to “wrap” the print/echo calls with or or ???

    There are several instances in the stock WP PHP code where calls are being made directly to the DB ($comment->comment_ID)… When I try and use the same exact calls, the parser completes, but the “display” is empty (nothing appears)…

    In this forum there is a reference to the “ecf_getComments($comments, $id);” issue… Could I be a victim of this?

    Thanks!!!!
    Your patience and understanding are MOST appreciated!

    Hugh
    2)

    December 11th, 2007 hhempel
  22. GREAT PLUGIN! Since we’re on the subject of flexibile forms can you please display how this PHP code will differ for the different kinds of form tags? For instance, since your example above is based on SELECT and OPTION tags, how would the PHP look if my extra form field is an INPUT field for a line of text?

    Ultimately I want my commenters to be able to enter their location into the text field exactly as they choose to display it. So they’d be free to write in either ‘New York’ or ‘NYC’ or ‘NY, NY’ or ‘New York City’ etc. If they’re international they should be able to enter things like ‘france’ or ‘new south wales, australia’ or ‘Cape Town, S.A.’ What would be the PHP syntax that goes with a plain text extra field?

    I hope this’ll be useful to all the readers here.

    December 18th, 2007 Malik
  23. [...] the Idea Shower » » Wordpress Plugin: Extra Comment Fields (tags: http://www.ideashower.com 2007 mes11 dia20 WordPress plugin comments blogging) [...]

    December 21st, 2007 rascunho » Blog Archive » links for 2007-12-21
  24. Hi,

    I can not download the plugin, I get the error:

    High security alert!!!

    You are not permitted to download the file “extra-comment-fields.zip”.

    URL = http://www.ideashower.com/files/scripts/extra-comment-fields.zip

    If anyone has a copy please reply as I have been looking for a plugin like for ages.

    Thanks

    January 8th, 2008 Joe
  25. When the comments are being moderated/edited from the backend, is there a way to edit the information that is submitted in the extra fields?

    January 10th, 2008 Jeffrey
  26. Is there a way to get the extra fields data included in the the RSS feed for the comments?

    January 24th, 2008 Michael Aivaliotis
  27. This just plain doesn’t work. On the ‘extra comment fields’ options page, (part 2 of tutorial) I add a field and save it. But when I return, it says I haven’t defined any extra fields. As a result, nothing works. It’s really disappointing!

    Any ideas why this would be happening? I’m using the latest verison of wordpress.

    Cheers

    Peter

    February 4th, 2008 Peter Watts
  28. Is there a way I can use this to add extra text fields and drop down menus that show in the comment field once the user submits a comment?

    I’m setting up a Wordpress Review site where users submit reviews and would like to have additional comment information such as pros, cons, how long have you used this product, etc…

    Thanks,

    Mike

    February 13th, 2008 Mike
  29. Mike,

    Absolutely, that’s what this plugin is for.  If you give me a little more specifics on what you’re trying to accomplish I can help you out!

    Nate 

    February 14th, 2008 Nate Weiner
  30. Hi Nate, thanks for the reply! Basically, I’m wondering how I can add extra fields to the comment form itself so that a user can add additional information with their comment. So for example, a user would not only see a field for their name, e-mail, url, and comment, but also a field for pros and cons, time you have used product, etc…

    Furthermore, I need these fields to be posted with each comment after submission by the user.

    I’m a complete newbie when it comes to php coding, but I’m pretty sure WP only supports the name, e-mail, url, and comment fields in the default wp-comments-post.php file, so I’m wondering what I need to do in order to add these fields to the comments.php in my theme folder and get WP to post them along with the default fields.

    -Mike

    February 14th, 2008 Mike
  31. Mike

    Do you have any experience with HTML?  You don’t need to make any changes to wp-comments-post.php.  All you need to change is your comments.php file in your theme.

    1. Add form fields as you normally would with any website to the comment form.  For example, if you wanted to add a ‘pros’ field you might add:
      <input type="text" name="pros" />
    2. Then go into your Wordpress Admin and under the Options menu select ‘Extra Comment Fields’.
    3. Then add the variable ‘pros’ (this should match up with the name of the field you added (see above)

    Now when a user submits the contact form, it should save the pros data.

    To display this data alongside the comments, thats where you’ll need to do a little bit of PHP.  But it’s not too bad.  If you open up the default theme’s comments.php file, you can do this to display the pros field.

    1. Find where php begins to ouput the LI’s that make up the OL with classname ‘commentlist’.  This is the actual list of comments that you see on the bottom of each post.
    2. Inside the ‘foreach ($comments as $comment) :’ loop you’ll see it outputting the date, author and comment content.
    3. Just above <?php comment_text() ?>, enter in: ‘<strong>Pros: </strong> <?php print $comment->extra_pros; ?>   (replace ‘pros’ with whatever your variable name is).

    Now that should output any data they submitted in the Pros field as well.

    Hopefully that helps, if you get stuck defintely write back! 

    February 18th, 2008 Nate Weiner
  32. [...] Why? Because theres a lot of great ideas being developed there. One of my favorite is the Extra comments plugin  [...]

    February 28th, 2008 Found ya, IDEA SHOWER « Minelabs
  33. Hey Nate,

    Thanks for the great plugin, I got it working after reading your last post. Thanks for that!

    Cheers,

    Leigh.

    March 3rd, 2008 Leigh
  34. Nate i know some HTML and PHP to setup with no problems. But i dont know how put or run the querie. I google about this but i dont know how…or run a querie or insert table….. can tell me or explanin how make work this plugin solution.

    March 7th, 2008 Andrew A
  35. Hi, does plugin allows you to make the drop-down options (e.g. General|Reviews|Support) like your comment form?

    Regards,

    ~Mint Tree~
    http://www.BestWordPressTemplate.com

    March 17th, 2008 Best WordPress Template
  36. Hello!
    I think this try.

    March 18th, 2008 Floroskop
  37. Hi Nate. Excellent plugin, it’s filling a very big void. I just wonder, would you ever consider making the comments editable? This is a big problem for me because the edit_comment function only allows you to edit the default fields. The only way to edit something entered in an extra field is to delete the comment and redo. As you can imagine, this isn’t the most user-friendly method.

    Maybe it isn’t something that would be included in the core of the plugin, but do you have any tips on what changes would need to be made to the admin template to allow this? It would be greatly appreciated and I’m sure there’s plenty of others using this plugin that would enjoy this feature.

    Regards,

    Peter

    March 18th, 2008 Peter Watts
  38. Hey Peter,

    I really would like to add it to the edit comments section but WP doesn’t make it very easy to hook into that part of the template.  I’m looking at WP 2.5 to see if they’ve made any improvements in that manner.  If not, I’ll probably work out an alternative method.

    Thanks! 

    March 20th, 2008 Nate Weiner
  39. Mint Tree,

    The plugin definitely always you to make drop-down options.  I’m using it for that on Idea Shower.  Take a look at the steps in the post, they use the same code I use on my site.

    Thanks! 

    March 20th, 2008 Nate Weiner
  40. Hi Nate,

    Your plugin is really nice!

    I would like to add more fields and I would like to make my comments form ajax driven, any suggestions?

    Again, really nice work on your plugin!

    March 27th, 2008 Michael
  41. Hi,

    I’m trying to get your plugin to work on a new site but not being successful.

    I’m using this in the form input

    Pros:

    Cons:

    I’m using this in the print area

    Pros: extra_Pros; ?>
    Cons: extra_Cons; ?>

    I’ve added the additional comment fields in WordPress but still it won’t display the field data…

    suggestions?

    Thanks in advance!!!

    March 27th, 2008 Michael
  42. One thing that’s missing (I think?!) is the ability to store previously submitted values in a cookie, as WordPress already does for the commenter’s name, URL and email.

    I’m working on a site where people will probably submit large numbers of comments. I want to add a ‘country’ field for styling purposes. But at the moment, whilst their name etc will be pre-populated into the form, the country selector can’t easily carry previous values over.

    It looks easy enough to do, by hacking wp-comments-post, but I’d rather not touch core files like that. Can it be fitted into the plugin? Maybe the values could come back as $comment_author_extra_whatever.

    April 1st, 2008 Simon
  43. Hi,

    Thanks for the plugin — I’m using WordPress 2.5, have installed the plugin, but none of the extra comment fields seem to be saved. (When I go to the Settings are of WP 2.5, there is a menu choice for “Extra Comments Fields”; when I use that, I see the “Add New Field” and “Current Fields” sections, but when I put the variable name and click “add field” it shows in the Current Fields section, but disappears if I navigate away from this screen or then try to add another field. Is the plugin simply not functioning in 2.5 yet? Not torqued, of course — just asking.

    Thanks.

    April 5th, 2008 XAMPPuser
  44. Hey Nate, just what i was looking for thx! However, a number of issues. Firstly I have to create the wp_comments_extra manually, secondly even though the field value gets stored i cant retrieve it via $comment->extra_field . Any ideas? FYI im using WP 2.5

    April 10th, 2008 Richard
  45. Hey Richard, I haven’t looked over this plugin for WP 2.5 yet so it may be related to that. If you send me the part of the code that’s display your comments I’ll take a look and see if I notice any other issues.

    Thanks!

    April 11th, 2008 Nate Weiner
  46. I have installed version 2.5 of Wordpress and your plug-in v. 0.2 (why not version 1 Beta)

    Anyway the code you show at the top of your page is not relevant to WP 2.5

    How would you call the value of the new field with this code :

    Here is what the code looks like (the top part of it)

    //———-code—————-//

    <li class=”" id=”comment-”>
    on
    comment_approved == ‘0′) : ?>
    Votre Coup de Gueule est en attente d’une modération.

    April 11th, 2008 William
  47. An other thing, it would be wise if you could show a simpler example involving a text fiel such as ‘enter your hometown’, as the drop down menu example complicates the code for those who aren’t php savvy and just want to use the plug-in to add a text field. If you had done so I might have been better able to sort the problem myself.
    This is obviously more of a problem for those who use WP v.2.5
    W

    April 11th, 2008 William
  48. Me again, sorry, but apart from creating a new table and a column for each new field, which I could do by using my mySql admin tool, what else does it do ? ie. I am wanting to edit the commnents and noticed that the new fields do not appear in the edit commnent page. If I delete a comment, will it also delete the data in the comment_extra table. A lot of things aren’t clear. In the end, I wonder if I should bother using it. Sorry for saying that. I am probably feeling too frustrated with that job…

    April 11th, 2008 William
  49. Thx Nat, here’s where i print the extra ‘business’ info

    extra_business) ? ‘, ‘.$comment->extra_business : ”); ?>
    </code.

    April 13th, 2008 Richard
  50. Nate, maybe im missing something but it appears one of your API hooks is referring to file activate_extra-comment-fields.php, which isn’t in the zip download you provide. Maybe this is why the database isnt being created

    April 14th, 2008 Richard
  51. Hi

    Cool plugin. Works on WordPress 2.5. But I would really appreciate it if you could help me out on this.

    I notice that when the admin deletes the comment, the entry inside table wp_comments_extra is not deleted.

    How do I get it to delete together with the comment in table wp_comments?

    Also, at the admin side, when the admin edits the comment, the $comment does not contain the values inside wp_comments_extra. How do I add it in?

    April 23rd, 2008 kumar
  52. Need an update for WP 2.5… I’ve well installed all you said on my blog, but nothing seem to work : there is no comments type, all are display.

    May 2nd, 2008 Thomas
  53. I just get your mail. I dunno if I understand well the previous system… The new system seem to be good, a sort of custom field for comments :-)

    Could you give us the code for the “All / General / Reviews / Support / Suggestions…” tabs ?

    May 5th, 2008 Thomas
  54. Nice work! I’m very pleased to see that the ability to edit posts has been added. However, it doesn’t seem to work for me. When I go to edit a comment, the extra fields and comment field are blank. They do not load the values from the database, so I can’t edit them. But on the manage comments screen, they appear perfectly! I’ve uploaded some pictures to show you what I mean. It sounds like a small bug somewhere. It would be great if you could help me out. Cheers, Peter

    http://vminor.com/images/manage.jpg
    http://vminor.com/images/edit.jpg

    As you can see in the manage shot, everything seems fine. But when I go to edit, I get nothing. I’m assuming it has nothing to do with not upgrading to 2.5.1…..

    May 11th, 2008 Peter
  55. Hi, I’m having exactly the same problem that XAMPPuser.
    Does anyone know what could be the cause?

    XAMPPuser said
    Hi,

    Thanks for the plugin — I’m using WordPress 2.5, have installed the plugin, but none of the extra comment fields seem to be saved. (When I go to the Settings are of WP 2.5, there is a menu choice for “Extra Comments Fields”; when I use that, I see the “Add New Field” and “Current Fields” sections, but when I put the variable name and click “add field” it shows in the Current Fields section, but disappears if I navigate away from this screen or then try to add another field. Is the plugin simply not functioning in 2.5 yet? Not torqued, of course — just asking.

    Thanks.

    May 15th, 2008 Wilson
  56. Thank you for the plug-in first of all.

    I’ve ran into an issue of trying to edit a comment in the admin screen. When I get to that page the comment field and the custom fields are actually blank. I accidently lost a comment this way.

    I run WP 2.5. Did you have any issues like that? Any ideas?

    May 18th, 2008 Daniel
  57. Still waiting :-)

    Would like to know also how to count the number of a specific comment category.

    May 19th, 2008 Thomas
  58. Alas, i’m running with the same problem with 2.5.1.
    The only time the extra comment is when ‘comment is waiting for approval’ is active (the value of the variable is still in memory). The variable is never written to the database, and when the comment is approved, all traces are lost.

    Keep up the good work, until a solution is found because the original idea is good!

    May 19th, 2008 Le Monochrome
  59. Hey all, I’ve released 1.1 which should solve the blank comment field issue. If you still have problems, drop me a line and I’ll investigate further.

    May 20th, 2008 Nate Weiner
  60. First, thank you for a great plug-in! It works great, except when I go to COMMENTS -> AWAITING MODERATION tab, I get the following warning messages:

    Warning: reset() [function.reset]: Passed variable is not an array or object in /home/c2013vis/public_html/wp-content/plugins/extra-comment-fields.php on line 180

    Warning: current() [function.current]: Passed variable is not an array or object in /home/c2013vis/public_html/wp-content/plugins/extra-comment-fields.php on line 181

    Comment Date Actions

    Warning: Invalid argument supplied for foreach() in /home/c2013vis/public_html/wp-admin/edit-comments.php on line 197

    May 27th, 2008 RR
  61. Also, is there a way to organize the comments by each field? (for example, numerically ordered by age or alphabetically grouped by location?)

    Thanks again

    May 27th, 2008 RR
  62. I’m having the same problem as Michael:

    Hey Nate, just what i was looking for thx! However, a number of issues. Firstly I have to create the wp_comments_extra manually, secondly even though the field value gets stored i cant retrieve it via $comment->extra_field . Any ideas? FYI im using WP 2.5

    Except that I’m using WP 3.3 and your .2.

    Help?

    May 30th, 2008 Tara
  63. Plugin seems to still be showing blank comments that are in moderation (haven’t been approved yet). Using Wordpress 2.5.1.

    June 5th, 2008 jay
  64. hi nate, great work. setting it up on 2.5.1 was a breeze but now i ran into comment moderation issues. the extra is rendered the right way in the comments overview and comment edit screen. the ‘comments waiting for approval’ stays empty (not producing any php errors as mentioned above). by approving/editing/saving a comment the whole comments_extra table records in the DB seem to get lost.
    would be great if you can fix this…
    keep up the good work!

    June 9th, 2008 Alex
  65. short update, just did another try: approving a comment out of edit-comment.php did only flush the record for this comment. aproving a comment or editing the extra from comment.php?action=editcomment&c= seems to work

    June 9th, 2008 Alex
  66. Hi Nate. Thanks for releasing 1.1. However, it doesn’t seem to entirely solve the problem. Now, when I go to edit a comment, the comment text is present (good!), but my custom fields are still blank. Any ideas? Peter

    June 10th, 2008 Peter
  67. hi tehre. do you use this plugin to separate your comments into the different sections? any other possible uses for this plugin? care to share your method for separating these commetns?

    June 10th, 2008 ovidiu
  68. I noticed that the entries in the database are deleted when you even just approve a comment in wordpress 2.5.1

    add_action(’wp_set_comment_status’, ‘ecf_delete_comment’);

    function ecf_delete_comment($id)

    This function just deletes the extra field of a comment without checking status.
    It should probably not do this if the comment action was set to approve… Fix needed

    June 21st, 2008 Norm
  69. Hey all, I pushed a new update out (1.2), it corrects the delete behavior described by Norm and I believe it should resolve some of the disappearing data being reported.

    Keep me posted on the results.

    June 23rd, 2008 Nate Weiner
  70. I had to change the ecf_install() function to this:

    function ecf_install() {
    global $wpdb, $table_prefix;
    $wpdb->query($wpdb->prepare(”CREATE TABLE IF NOT EXISTS `” . $wpdb->prefix . “wp_comments_extra` (
    `comment_id` bigint(20) unsigned NOT NULL auto_increment,
    PRIMARY KEY ( `comment_id` ))”));
    }

    June 26th, 2008 Jon Rogers
  71. [...] the Idea Shower » » WordPress Plugin: Extra Comment Fields [...]

    June 26th, 2008 My Today’s Diigo 06/26/2008 « Rif.webmemo
  72. If I want to display those comment in every page in the sidebar. how?

    thanks!

    June 27th, 2008 kailoon
  73. How to use it when I am using the pageg comment plugin. Because it is using a file called comments-paged.php. The value cant be shown.

    Please help. Thanks!

    June 30th, 2008 kailoon
  74. [...] Wordpress Plugin - Extra Comment Fields - This Wordpress plugin allows you to add additional fields for users to complete when submitting a comment. The extra data will be saved in the wp database and can be retrieved when showing a post’s list of comments. [...]

    July 2nd, 2008 Best Design Resources of June 2008 | CrazyLeaf Design Blog
  75. Hi Nate, thanks for the update, but it still doesn’t seem to solve my problem. As I mentioned earlier, when I go to manage comments, my extra fields are displayed nicely. But when i actually go to edit one of them, the fields come up blank. This is very bad, because if the comment is then edited and saved, the extra fields are overwritten with blank values. Any help would be greatly appreciated.

    Peter

    July 5th, 2008 Peter Watts
  76. Thanks for the plugin Nate.

    I was having a few problems. I’m using a none-standard prefix on my tables and this was the cause of the problem.

    On line 210 the FROM statement was missing a couple of $wpdb->prefix tags. It should read
    FROM “.$wpdb->prefix.”comments c, “.$wpdb->prefix.”comments_extra xc

    I’m still having the same issue as RR on the comment moderation page it’s throwing a 3 errors. So far I’ve failed to work out why. Will post again if I figure it out.

    July 9th, 2008 Tom Styles
  77. Could you give us the code for the “All / General / Reviews / Support / Suggestions…” tabs ?

    Would like to know also how to count the number of a specific comment category.

    Thanx in advance.

    July 13th, 2008 Thomas
  78. Hello, nice plugin, exactly what I was looking for :-)
    I’m having same issue as Jay. I’m using Wordpress 2.5.1 et the last version of your plugin.
    It seems that the plugin “push” a [-1] => stdClass Object (…extra_ data…) in array $comments that shows as “blank” comment for last comment post awaiting moderation. If few comments are waiting moderation, then extra data from the [-1] => stdClass Object (…extra_ data…) take last post extra data.

    July 18th, 2008 absynthe
  79. Ok, I figured out problem with “blank” comment awaiting moderation is related to function ecf_whatCommmentObject() that return a -1 value to $comments index when it’s empty. As I don’t get why Nate is using that return -1 (I believe on purpose) and as I don’t want to touch his code, here is a simple work around for people getting that problem, just use : in your comment page after the statement.

    July 19th, 2008 absynthe
  80. Great plugin, gotta thank your for it :) now i’m having a little problem, i’m running wordpress 2.5.0 with your the 1.2 plugin version. When I had the previous version if I just switched to the moderation tab I would have that error concerning the reset and the current function and the extra field would be deleted… now with 1.2, the title isn’t deleted, but the error is still there, so, I can’t really access the moderation tab. Any ideas? Thanks again

    July 22nd, 2008 francis
  81. [...] found a really cool plugin that will allow me to add extra fields to the comments form. It seems to be the only one of it’s [...]

    July 27th, 2008 ExtraLuv In My Blog Comments | KeithJamesLock.com
  82. I am getting the same error as RR.

    When I go to COMMENTS -> AWAITING MODERATION tab, I get the following warning messages:

    Warning: reset() [function.reset]: Passed variable is not an array or object in /home/c2013vis/public_html/wp-content/plugins/extra-comment-fields.php on line 180

    Warning: current() [function.current]: Passed variable is not an array or object in /home/c2013vis/public_html/wp-content/plugins/extra-comment-fields.php on line 181

    Comment Date Actions

    Warning: Invalid argument supplied for foreach() in /home/c2013vis/public_html/wp-admin/edit-comments.php on line 197

    Any ideas?

    August 1st, 2008 Kevin
  83. *Database filling with extra comment field spam.*

    My wp_comments_extra table has 3351 records, 3300 of which are spam.

    When Akismet deletes spam, can it delete spam records from wp_comments_extra too?

    Is there an SQL statement I can enter via PhpMyAdmin which will remove all records that don’t have a matching comment id# in the table wp_comments?

    Besides that, this is a great plugin.
    Thanks Nate - and anyone else who responds.

    August 5th, 2008 Jonathon
  84. I’m having that same problem with two buttons in the admin panel:
    1) Awaiting Moderation yields:
    Warning: reset() [function.reset]: Passed variable is not an array or object in extra-comment-fields.php on line 181

    Warning: current() [function.current]: Passed variable is not an array or object in extra-comment-fields.php on line 182

    Warning: Invalid argument supplied for foreach() in edit-comments.php on line 197

    2. Approved. Yields the same errors.

    3. Show all Comments. This works fine except it doesn’t show me my extra comment field values at all, no biggie.

    Thanks for this plugin, it was exactly what I was looking for.

    August 10th, 2008 Tim
  85. I’m getting the same errors as Kevin.

    When I go to COMMENTS -> AWAITING MODERATION tab, I get the following warning messages:

    Warning: reset() [function.reset]: Passed variable is not an array or object in /home/c2013vis/public_html/wp-content/plugins/extra-comment-fields.php on line 180

    August 13th, 2008 scotjam
  86. Is this supported by wordpress 2.6?

    August 20th, 2008 jeff
  87. can I use a select
    option 1 /option
    option 2 /option
    /select

    with this plugin?
    thanks

    August 22nd, 2008 shmar
  88. Hi, seems to be working at the moment thank you very much for the easy description.

    Could you, or anybody help me, so if a value is not entered it will say ‘Unknown or some other text’.. So:

    extra_age; ?>
    but if theres no value for the comment in question, then print ‘unknown’

    September 5th, 2008 Mark
  89. Hi!
    Cool plugin! … I cannot use this plugin with “Paged Comments” plugin, anyone can help please?

    Should I change some codes in “paged-comments.php” etc?

    Looking for your reply.

    Cheers
    Schahryar

    September 5th, 2008 Schahryar
  90. Nice plugin here seems to be working great atm.
    In response to Jeff it is working fine on my 2.6.1
    In response to shmar, be more specific? You can add any fields really, that submit value to be stored.

    September 8th, 2008 Mike
  91. [...] the Idea Shower Wordpress Plugin: Extra Comment FieldsWordpress plugin to add additional fields to the comment form. Overview. This Wordpress plugin allows you to add additional fields for users to complete when submitting a [...]

    September 15th, 2008 Wordpress Plugin Center - WP Comment Plugin - Subscribe to Comments Notifications Manager Plugin | Wordpress Wow
  92. [...] Extra Comment Fields plugin for Wordpress [...]

    September 26th, 2008 Improved Email Notification On Replies | Ever After
  93. Hello, I am using WP 2.6.1 and I am having the same problem as a few persons over here, but can’t find how to have it work.

    My fields write well in the DB but I can’t read from it in the comments loop. The admin panel reads it well though.
    My line is:
    extra_ville; ?>

    Is there any new info available to make this work?

    Thanks

    October 5th, 2008 mj
  94. Made an error there.. the line is extra_ville; ?>

    October 5th, 2008 mj
  95. Sorry for the flood…

    print $comment->extra_ville;

    October 5th, 2008 mj
  96. Hey there, I was just hoping you could help me with something.

    I wish to add a heading to my comment. I have gone about everything as I did to get it working the fist time, but I was wondering if you could have a look at the code, as the heading does not seem to be appearing this time.

    This is what I placed for the form field:

    <p style=”margin:0;”><label for=”title”><small>Review Title/Summary <?php if ($req) echo ” (required) “; ?></small></label></p>
    <p style=”margin:5px 0 10px 0;”><input type=”text” name=”title” id=”title” value=”<?php echo $comment_author_title; ?>” size=”22″ tabindex=”1″ /></p>
    This matches my site, as it is part of a review site.

    Then where I wish the heading to appear:

    <p><b><?php print $comment->extra_title; ?></b><br><br>
    <p><?php comment_text() ?></p>

    Does this look alright to you? The heading doesn’t seem to be showing for me.

    Thanks so much for your help!

    October 13th, 2008 Lesley
  97. Plugin exactly what I need. Though it writes to the new database (and does create the correct prefix), I too am having trouble getting calls to appear. Anyone out there with thoughts?

    Thanks. Great plugin if I can get the calls to work.

    October 18th, 2008 Jim
  98. Terrific plugin!

    I had no problems with install and setup in Wordpress 2.6.2.

    When I go to the “Comments” area in WP dashboard it nicely shows the extra field with the value supplied by the visitor.

    However, when I go to edit any of the comments by clicking on the commenter’s name, the comment edit page I end up on does not contain the new field anywhere. So when I make any changes to the default fields and resave, the value in the extra field disappears and becomes blank on the website.

    Thoughts? Help?

    Thanks!

    October 22nd, 2008 Diane
  99. @scotjam, @Tim
    I had the same problem with the comment moderation not showing up in WP 2.6; dug through the code and the problem seems to arise from where ecf_addOnComments() is called via the do_action(’manage_comments_nav’,$comment_status); on line 178 of edit-comments.php

    I think I might have resolved this by commenting out line 177 in extra-comment-fields.php it should be
    $comments = (($overrideComments)?($overrideComments):($comments));

    I’m not entirely sure this works completely, so use at your own risk. Just thought I’d try and help pinpoint the issue.

    November 8th, 2008 Jeff
  100. This plugin was a bit of work but if I can get the last part working it will have been worth the effort. I’ve got the form working and the data is writing to the db but I can’t display the information in the comment loop with the sample code. Looks like others hare having this trouble with 2.6+ as well.

    November 14th, 2008 Daisy
  101. [...] first thing you’ll need is the Extra Comment Fields plugin. I used Version 1.2 Beta if you want a direct download [...]

    November 21st, 2008 How I added the Twitter ID field to comments on Twitip.com
  102. I tried adding this but using Brian’s Threaded Comments it has been a challenge.

    If you use the default theme it works fine.

    November 23rd, 2008 Gary Jones
  103. Does any one know how to add a content into missing alt tags found in avatar images in comments in WP blog system? The Alt tags there are missing, it’s mandatory to have them as per xhtml compliance.

    November 23rd, 2008 Convert
  104. hi hi hi!
    powerfull plugin, congratulations. Work 100% on wp 2.7 rc3. But on moderate my spam comments appear this:

    Warning: reset() [function.reset]: Passed variable is not an array or object in /home/polkadots/www/wp-content/plugins/extra-comment-fields.php on line 181

    Warning: current() [function.current]: Passed variable is not an array or object in /home/polkadots/www/wp-content/plugins/extra-comment-fields.php on line 182

    What i have to do?
    Sorry about my ugly english, im from brazil.

    tks!

    November 26th, 2008 Tiago Jaime Machado
  105. Wow. I’ve spent a few days now searching for something like this. You’re an absolute god in my book.

    This works wondrously well!

    I’ve used this in order to create a per-comment rating system for a client. Genius plugin, and highly recommended for all my future projects!

    Thanks a lot, I greatly appreciate this.

    November 30th, 2008 Paul
  106. This plugin works great! It took me 30 minutes of hacking functions to realise there was a plugin (this one), to add custom fields to the comments in wordpress, afterwhich it took me about 3 minutes to implement and set up.

    You the man.

    December 3rd, 2008 Nick Soper
  107. And what if the field is empty? There would be only “User’s Age is:”. How can I remove the text when the field is empty?

    December 6th, 2008 levani
  108. Yes, there is an error in 2.7, when you go to pending comments as “Tiago Jaime Machado” says 5 comments above, same error!

    December 20th, 2008 Brian
  109. WooHOO!!! Thanks for the incredible plugin. Just installed in WP 2.7, and it works beautifully. There are a few extra steps involved (you must use the custom callback response, detailed here: http://codex.wordpress.org/Template_Tags/wp_list_comments ), but it’s fabulous. Thanks again!

    December 24th, 2008 Sarah Bray
  110. Hi, thanks for a great plug-in. However I think I have found a general error in 2.7. I’ve successfully managed to add my new field, ‘location’, in the form and even capture it. However I am want to backdate some of my comments so I go into ‘edit comments’ in my dashboard. When I edit it displays name, email, url and comment, but not ‘location’, and when I ‘Update comment’, the location data is lost.

    How do I include this field within the edit page, or avoid losing it when I edit the comment?

    Thank you for your time.

    January 1st, 2009 jamie
  111. Are you planning to update this for Wordpress 2.7? It sounds like from posts here there might be a few problems when reviewing comments with this plugin installed. Looks like a helpful plugin that I’m looking for though, Thanks,

    January 6th, 2009 Jesse Sutherland
  112. This plugin has one little bug! When I write text in new line after publishing it’s only one line!!! How can I resolve this problem?

    January 11th, 2009 Levani
  113. In admin section, when I edit the comment, the extra fields are gone…

    January 28th, 2009 Sunny
  114. Well, I’d the same problem described above with calling back the custom field’s data to show on the comments page, just as regular content as the rest of the comment.

    I fixed it replacing the query in function ecf_getComments($comments, $post_id) as described below:

    Replace:
    [...]
    $result = $wpdb->get_results(”SELECT …
    [...]

    With:
    [...]
    $wpdb->xc = $wpdb->prefix . ‘comments_extra’;
    $wpdb->c = $wpdb->prefix . ‘comments’;

    $sql = “SELECT xc.comment_ID, “.ecf_qryStr($fields).” FROM $wpdb->c c, $wpdb->xc xc WHERE c.comment_post_ID = ‘$post_id’ AND c.comment_ID = xc.comment_ID”;

    $result = $wpdb->get_results($sql);
    [...]

    Now it works perfect! And I can format the fields as I like, using extra_age; ?> or whatever.

    Hope this may help someone…

    January 29th, 2009 Pedro J. Arocena
  115. Awesome plugin! This will do exactly what I need but I’m having a little problem getting it to work.

    The page I’m trying to set up is http://74.220.207.198/~corneru6/ministries/prayer-praise/ with the option for the user to select “Prayer request” or “Praise Report.”

    I installed the plugin and added the field variable named “prayerreq” under the settings. I then added:

    Prayer Request
    Praise Report

    to my comments.php file and then added

    Comment is: extra_prayerreq; ?>

    to my functions.php file directly after:

    For some reason though the results of the extra field variable are blank. I’ve tried several times and have the same results. I’m running WP 2.7.

    Any suggestions? I’d love to get this to work. Thanks.

    February 3rd, 2009 Brad Ruggles
  116. The other thing I noticed is that when I go to the Settings > Extra Comments Field and type in the name of my variable it shows up below. But if I navigate away from that page and then go back to the Extra Comments Settings page it isn’t there anymore. Is it supposed to stay there?

    February 3rd, 2009 Brad Ruggles
  117. Thanks a lot for an awesome Plugin. I am trying to the same thing you are doing here on my blog = ask what type of Comment in a dropdown and then have the comment bubbles in a different color based on the answer. I am using 2.7 but having some issues. Any chance you could share the comment.php code you are using?

    Thanks a lot

    February 15th, 2009 John
  118. Really not sure what I am doing wrong, I followed all the steps but when I test and insert comment, the new field is allways empty. As well, when I go back to settings and check “extra commments field” it is empty. Is that normal? or should it display the entry I made earlier “age”

    Sorry guys, I am not as good as you

    Thanks a lot

    February 15th, 2009 John
  119. Hey guys, does anyone has an easy walkthrough on how to do it on 2.7. The wp-list-comment is throwing me off.

    By the way, when creating an extra field if I later return to “Settings - extra comment” the page tells me that I do not have any extra setup? is this correct or am I having issues creating the new table?

    Thanks

    February 15th, 2009 steven
  120. This is a very useful plugin. I have it installed under Wordpress 2.7.1. I am also seeing the problem mentioned above when editing Pending comments, the error message is:
    Warning: reset() [function.reset]: Passed variable is not an array or object in /home/credcdsp/public_html/credit-cards/wp-content/plugins/extra-comment-fields.php on line 181

    Warning: Invalid argument supplied for foreach() in /home/credcdsp/public_html/credit-cards/wp-admin/edit-comments.php on line 308

    I’d be glad to help debug if I can.

    Thanks.

    February 16th, 2009 Josh
  121. Here is a solution. In the ecf_addOnComments function, the following line appears:

    $comments = (($overrideComments)?($overrideComments):($comments));

    However, a quick var_dump of $overrideComments reveals that it looks like this:

    array(1) { [0]=> string(9) “moderated” }

    I’m not sure why. However, if you comment out the line of code above ($comments = …), the bug goes away and you can view Pending comments again.

    February 16th, 2009 Josh
  122. [...] You will need to download and install the Extra Comment Fields plugin available here. Thanks to the folks at the Idea Shower for that [...]

    February 24th, 2009 Tutorial: How to add a Twitter Field to Comment Form and then insert the link into their comment . | Evil Genius TV | Marketing, Humor, and Observations - from a Fancy Dude - JJ Kennedy
  123. I think I fixed a bug with this plugin. I was getting blank comments added to the bottom of some posts but not all posts. See http://bit.ly/15fzvM . The fix is here:
    http://pastebin.com/f781b16ba . Spam comments in the database were causing an empty comment object to appear when listing the comments in the template.

    February 26th, 2009 Chris
  124. If a comment is not approved it is visible to public.
    What is wrong?

    February 27th, 2009 Marco
  125. Solved: (1)unapproved comment is showed, (2)amministration page don’t show comment awaiting moderation or spam.

    1)
    replace in function ecf_getComments($comments, $post_id):
    $result = $wpdb->get_results(”SELECT xc.comment_ID, “.ecf_qryStr($fields).”
    FROM wp_comments c, wp_comments_extra xc
    WHERE c.comment_post_ID = ‘$post_id’ AND c.comment_ID = xc.comment_ID”);

    width:

    $wpdb->xc = $wpdb->prefix . ‘comments_extra’;
    $wpdb->c = $wpdb->prefix . ‘comments’;

    $sql = “SELECT xc.comment_ID, “.ecf_qryStr($fields).” FROM $wpdb->c c, $wpdb->xc xc WHERE c.comment_approved = 1 AND c.comment_post_ID = ‘$post_id’ AND c.comment_ID = xc.comment_ID”;

    $result = $wpdb->get_results($sql);

    2)
    comment this line in function ecf_addOnComments($overrideComments=0):

    $comments = (($overrideComments)?($overrideComments):($comments));

    February 27th, 2009 Marco
  126. Hii

    I’m using the plugi for “country” field and it shows the previous entry. That is, if someone is making a comment, his “country” field is pre-filled with the country of previous commenter.

    Also, activating the plugin creates an empty comment always on top. That is, the last comment is always empty.
    Ioffersearch.com Blogs - Just another Ioffersearch.com weblog

    March 7th, 2009 ioffersearch001
  127. Oh my, you just save my life mate. This is the plugin I’ve been looking for! Thanks

    March 27th, 2009 geekTips
  128. I’m getting a couple of error in the comments section like this (using WP 2.7)

    Warning: current() [function.current]: Passed variable is not an array or object in /home/tvcm/public_html/roverspics/wp-content/plugins/extra-comment-fields/extra-comment-fields.php on line 182

    March 28th, 2009 Steve T
  129. i want to make my comment system like yours. is there any docs about how you did your comment system?

    March 29th, 2009 Bülent Sakarya
  130. Hi, I really like this plugin. I especially like how you added it to your site (colors and a sorting mechanism to see only specific comments. Can you provide us the code for the sorting (link to only show those types of comments) and coloring of comments?

    March 30th, 2009 Anna
  131. How does it work?

    April 4th, 2009 DDR??
  132. Ehi! I found an error on line 210, where must replace ‘wp_’ with ‘” . $wpdb->prefix . “‘ (remove the ‘ ). With this replacement it works with all prefix of database’s table!

    PS: Thank you for the plugin! It’s perfect!!!

    April 11th, 2009 Michele
  133. I implemented the method described by Darryl Rowse using the Extra Comment Field plugin, but it is not ideal because I am getting the error that prevents me from seeing comments identified as spam to decide if I want to delete them. In particular, I am getting this on the page where I should be able to see spam comments:

    Warning: reset() [function.reset]: Passed variable is not an array or object in /plugins/extra-comment-fields.php on line 181

    Warning: current() [function.current]: Passed variable is not an array or object in /plugins/extra-comment-fields.php on line 182

    Lines 175-182 of that file are (I added the brackets here):

    [function ecf_addOnComments($overrideComments=0) { global $comments, $wpdb;
    $comments = (($overrideComments)?($overrideComments):($comments));
    if (!empty($comments)) {

    $compareComments = $comments;
    $fields = ecf_fieldList();
    reset($comments);
    $firstComment = current($comments);]

    I see that other commenters have suggested various fixes . . . can you post the fix that works since I do not want to experiment with the various approached posted here.

    Thanks.

    April 13th, 2009 JHS
  134. Fantastic plug-in. Love it. Just have a quick PHP question. What would be the easiest way to display all comments with a particular value in one of the extra fields? Say if I had an extra field for States, and I wanted to display all comments that were from Texas. Kind of like you have it here, except I see you do your’s with a bit of JS; I’m looking for a PHP solution.

    Only thing I can think of is to create a function with “inner join” that selects the correct comments. But I’m having some trouble with that. Thoughts?

    April 24th, 2009 mark
  135. Hi, I found a bug in the function: ecf_getComments when I need to print the results in the comment.php but I use a personal string in the talbes of my database. My tables in MySQL have something like: “wp_PeRsOnALsTrInG_comments” instead of “wp_comments”. In host what have WordPress Automatic Install (like Dreamhost) these strings are auto-generate. To fix this bug just replace “wp_comments” and “wp_comments_extra” to the strings founded in the MySQL. The plugin works nice now!

    April 27th, 2009 Caciano Gabriel
  136. An incredibly useful plugin, as others have mentioned there seems to be a few bugs with Wordpress 2.7.

    Namely when editing or deleting comments, has anyone else added the input field to the correct admin template? A quick guess would indicate this to be the problem.

    April 28th, 2009 Ash
  137. I’m using comments WP 2.7 and it took me some time to make this plugin running. The added fields were not stored in the settings page.
    I am using comments only on pages, not on posts, therfore I disabled (Settings=>Discussion):

    [] Allow people to post comments on the article

    After I have enabled this field, it worked :-)

    The same probleme was reported before, maybe because of the same reason.

    Thanks for the plugin!

    May 13th, 2009 MiKa
  138. I’ve got the plugin up and runnng, but I am trying to figure out how to get the selection from my dropdown box to show with the comment. I used the directions give on Probloggers site (mentioned in your update above) but it doesn’t show.

    I’ve got it in the right place.

    Any suggestions?

    May 15th, 2009 karla | looking towards heaven
  139. I’m so excited to have found this plugin! I can’t wait to install it and see how it works! I’m doing a website for a plumber. I’m using the comment function on wordpress to serve as a service review system and wanted a couple of more fields for customers to fill in. Thank you!!!

    May 26th, 2009 Lauren
  140. OK, I’ve completed the first two steps but am having trouble inserting the php into the comments.php file.
    I’m using version 2.7.1, and I’m not able to figure out where to put the code.
    This is what my commentslist code looks like:


    $bfa_ata_avatar_size,
    ‘reply_text’=>__(’ · Reply’,'atahualpa’),
    ‘login_text’=>__(’Log in to Reply’,'atahualpa’),
    ‘walker’ => new Walker_Comment2,
    ‘max_depth’ => ”,
    ’style’ => ‘ul’,
    ‘callback’ => null,
    ‘end-callback’ => null,
    ‘type’ => ‘comment’,
    ‘page’ => ”,
    ‘per_page’ => ”,
    ‘reverse_top_level’ => null,
    ‘reverse_children’ => ”
    ));
    wp_list_comments(array(
    ‘avatar_size’=>$bfa_ata_avatar_size,
    ‘reply_text’=>__(’ · Reply’,'atahualpa’),
    ‘login_text’=>__(’Log in to Reply’,'atahualpa’),
    ‘walker’ => new Walker_Comment2,
    ‘max_depth’ => ”,
    ’style’ => ‘ul’,
    ‘callback’ => null,
    ‘end-callback’ => null,
    ‘type’ => ‘pings’,
    ‘page’ => ”,
    ‘per_page’ => ”,
    ‘reverse_top_level’ => null,
    ‘reverse_children’ => ”
    ));
    } else {
    wp_list_comments(array(
    ‘avatar_size’=>$bfa_ata_avatar_size,
    ‘reply_text’=>__(’ · Reply’,'atahualpa’),
    ‘login_text’=>__(’Log in to Reply’,'atahualpa’),
    ‘walker’ => new Walker_Comment2,
    ‘max_depth’ => ”,
    ’style’ => ‘ul’,
    ‘callback’ => null,
    ‘end-callback’ => null,
    ‘type’ => ‘all’,
    ‘page’ => ”,
    ‘per_page’ => ”,
    ‘reverse_top_level’ => null,
    ‘reverse_children’ => ”
    ));
    }
    ?>

    Any suggestions on where to insert the code would be greatly appreciated!!
    Thanks!

    May 26th, 2009 Lauren
  141. Good plugin, thanks!

    One suggestion, I’m using Wordpress MU (WPMU) and there is a very slight adjustment needed to make it compatible.

    In the function “ecf_getComments()”, replace the following line:

    FROM wp_comments c, wp_comments_extra xc

    …with…

    FROM “.$wpdb->prefix.”comments c, “.$wpdb->prefix.”comments_extra xc

    June 2nd, 2009 Darren
  142. Hi,

    I have installed the plugin, but when I go to add a New Field, it looks like it’s added as it comes yp on screen, but when I refresh the page or go away to another page and come back, the field is nowhere to be seen?

    June 16th, 2009 Keith
  143. Has anyone been able to fix the issue in 2.7/2.8 with it not saving the fields???

    June 18th, 2009 Jeff
  144. No recent posts so Im hoping this is not a dead project…

    Anyway I am having troubles retrieving data from new fields. Looking in Sql DB I see new fields under new table wp_comments_extra, I see data is being posted to these fields when entered into new forms, but for some reason I cannot retrieve the data with the above code.

    If you can help its appreciated

    June 26th, 2009 Dx
  145. Hello everybody. This plugin is great but I want it to work )
    I have the same problem as Marco:

    1) Public can see the comments while they are not approved

    2) I cant see comments on my dashboard to approve or delete it

    Ive been trying to fix it like Marco sad, but its not working for me

    can anyone help me please ?

    respectfuly, Robert

    July 4th, 2009 robert
  146. I am using wordpress 2.8 and when I try to view comments I get the following

    Warning: reset() [function.reset]: Passed variable is not an array or object in /home/ermichi7/public_html/wp-content/plugins/extra-comment-fields.php on line 181

    Warning: current() [function.current]: Passed variable is not an array or object in /home/ermichi7/public_html/wp-content/plugins/extra-comment-fields.php on line 182

    Warning: Invalid argument supplied for foreach() in /home/ermichi7/public_html/wp-admin/edit-comments.php on line 312

    How do I fix this?

    July 6th, 2009 Ray
  147. This isn’t working for me. I’m having the same issue as multiple people above, adding and saving a new field does not actually save the field. when navigating away from page and returning, field is not there. I have read instructions carefully and tried on multiple wp installs.

    attempting this on wp 2.8, however I’ve seen that this issue occurred on much older posts as well.

    hints anyone?

    July 8th, 2009 benjamin
  148. Would you be able to update this plugin and your tutorial to work well with WordPress 2.8. Your tutorial is different to the layout of WordPress 2.8

    July 13th, 2009 Stephen
  149. This plugin doesn’t work under WordPress 2.8, I get errors in the comment administration, adding custom fields doesn’t work on the plugin screen (they appear and then disappear when I revisit the page) and nothing appears in my comments.

    I think an update is due… ;)

    July 14th, 2009 AndyW
  150. Please ignore my last comment - the plugin works perfectly in WordPress 2.8 however only if you install the plugin file directly in the plugins directly. DO NOT install within the a sub directory (for instance like you do with Askimet).

    July 14th, 2009 AndyW
  151. One last post… I did still get some errors in the admin panel, but applying fix in Josh’s comment from February 16th, 2009 fixed it. I now have a fully functioning perfect plugin!

    July 14th, 2009 AndyW
  152. Hi bunch of errors on 2.8.1 in the comments pane and nothing is getting written into my db…


    Warning: reset() [function.reset]: Passed variable is not an array or object in /nfs/c04/h01/mnt/60501/domains/ruth.thomasedmond.com/html/wp-content/plugins/extra-comment-fields/extra-comment-fields.php on line 181

    Warning: current() [function.current]: Passed variable is not an array or object in /nfs/c04/h01/mnt/60501/domains/ruth.thomasedmond.com/html/wp-content/plugins/extra-comment-fields/extra-comment-fields.php on line 182

    Warning: Invalid argument supplied for foreach() in /nfs/c04/h01/mnt/60501/domains/ruth.thomasedmond.com/html/wp-admin/edit-comments.php on line 312
    Author Comment In Response To
    Author Comment In Response To

    Check for Spam

    Warning: reset() [function.reset]: Passed variable is not an array or object in /nfs/c04/h01/mnt/60501/domains/ruth.thomasedmond.com/html/wp-content/plugins/extra-comment-fields/extra-comment-fields.php on line 181

    Warning: current() [function.current]: Passed variable is not an array or object in /nfs/c04/h01/mnt/60501/domains/ruth.thomasedmond.com/html/wp-content/plugins/extra-comment-fields/extra-comment-fields.php on line 182

    Look forward to an update as it will hopefully help me out with Twitter integration.

    Cheers.

    July 15th, 2009 Gareth
  153. Hey Nate, exactly what i was looking for, but unfortunately i have the same pb as Wilson and XAMPuser above (yeah i read all the posts); i fill a new field in the admin and when getting back to the page, it’s just not saved, all empty. I tryed localy with php 5.2.8 and online with php 5.1.6 and same problem.

    Any clue ? how yeah, both wp 2.8.

    July 16th, 2009 kevin
  154. Correction of my previous message, my both wp are 2.7.1, not 2.8

    July 17th, 2009 kevin
  155. Great plugin! I hope you can update it for WP 2.8.1. As pointed out by Josh and Marko above, commenting out a single line of code in the plugin file fixes the errors in the admin panel when reviewing/editing comments.

    The one remaining bug is that if one tries to edit the comment, there is no place for the field to be displayed. As a result when the comment is re-saved, the additional data in the custom fields is overwritten as blank and thus lost.

    I really hope you can get around to updating the plug-in. I was very surprised to see that there is no other plug-in that attempts anything similar. Great job and thanks again!

    July 20th, 2009 Sudeep
  156. Has anyone managed to make this plugin work with WP 2.8? I’ve been trying but the plugin won’t write data in the database it seems. Or has anyone any suggestions how to add extra fields for comments?

    July 24th, 2009 silakka
  157. Seems to work well. However I can’t moderate any comments at: /wp-admin/edit-comments.php on my WP 2.8 install. Deactivating the plugin makes them appear again.

    July 27th, 2009 Eric
  158. Great plugin, need a small update or text in the support area. The plugin will work if as Josh (February 16th, 2009) said the line 176 should be remarked.
    It works - wordpress 2.8.2
    Thanks,
    Daniel

    August 5th, 2009 Daniel
  159. Hi, how can I this plugin work with wordpress 2.8.4?

    August 15th, 2009 Levani
  160. I get the following when I try to view comments

    Warning: reset() [function.reset]: Passed variable is not an array or object in /home/ermichi7/public_html/wp-content/plugins/extra-comment-fields.php on line 181

    Warning: current() [function.current]: Passed variable is not an array or object in /home/ermichi7/public_html/wp-content/plugins/extra-comment-fields.php on line 182

    Warning: Invalid argument supplied for foreach() in /home/ermichi7/public_html/wp-admin/edit-comments.php on line 315

    I just upgraded to 2.8.4 but had the problem in earlier versions. When I first installed the plugin it worked fine and then after a few months I started getting the above error.

    Any fix?

    August 18th, 2009 Ray
  161. I like your comment system, i believe you have done it using this same plugin.
    I am looking to use the comment_type field to have 4 different comment forms in the same page at different location.
    Will this plugin help in that as well? If you could share the script for your comments display, it would be great.

    August 19th, 2009 Rashmi Ranjan
  162. Marco’s comment solves the problem. thanks, man!

    August 24th, 2009 Leonardo
  163. Hi Nate,
    THX for this plugin it really helped me. On question though. Can you advise me on how I get these extra fields to be mailed to “Comment Subscribers” . I know a little PHP, so any advice will be appreciated.

    Thank You
    Kindly

    August 25th, 2009 Michael Montgomery
  164. Hi Nate ,

    I was able to solve my predicament. I’m now able to mail all custom fields to “Comment Subscribers”. If anyone else has a similar request I’m more than willing to assist.

    Thank You
    Kindly

    August 25th, 2009 Michael Montgomery
  165. Great Plugin, I tried it with WP 2.8.4 and works fine.

    August 25th, 2009 Guillaume
  166. I am having the same issue others have reported - in admin, when I try to add a new field and click save changes, it shows, then as soon as I come back to the page again, it’s gone.

    August 31st, 2009 dave
  167. When I view comments on a site running this plugin I get the following erros: Warning: reset() [function.reset]: Passed variable is not an array or object in [BLOG LOCATION]/wp-content/plugins/extra-comment-fields.php on line 181

    Warning: current() [function.current]: Passed variable is not an array or object in [BLOG LOCATION]/wp-content/plugins/extra-comment-fields.php on line 182

    I am running wordpress version 2.8.4 and Extra Comments Field v1.2

    There were no problems with wordpress 2.8.3 that I was aware of.

    This is a great plugin. Please contact me if we can assist you with fixing or promoting this plugin.

    best wishes
    Dave
    SmartMediaPro.com

    September 2nd, 2009 Dave
  168. This is the plugin I have been searching for a while. Thanks a lot.
    It seems to be incompatible with wordpress 2.8.4. When i click on Comments menu, none of the comment items are displayed. Could you suggest a solution. Appreciate your time.

    September 4th, 2009 Temi
  169. Hello,

    I just had a quick question about tab-index..

    I’ve successfully added fields to my form, made them mandatory, and used them in content output, all working wonderfully, thank you so very much ^_^

    The issue I’m having is with the tab-index for the new fields. I’ve inserted my fields after name and before email, but pressing tab while in the name field jumps to the email field, not to the first new tab as I’d hoped :P

    Do you know how to sort this? ^_^

    September 11th, 2009 Garry
  170. Editting comments via the admin was broken because of a bug in ecf_getComment. Commenting out line 33 fixed the problem for me. I’m sure this isn’t the correct fix, and I’m not using the edit comment feature. Sorry no patch.

    #add_filter(’comment_edit_pre’, ‘ecf_getComment’);

    September 24th, 2009 Robert Corsaro
  171. Hi, it seems that your plugin is the only one existing in the wordpress world that can add a custom field to comments. If you could just guide us I am sure one of us can get it working in 2.8.4.

    Any help would be greatly appreciated.
    Thanks!

    September 25th, 2009 Trinifieds.com
  172. Marco, thanks! Your changes make plugin work also in WP 2.8.4

    September 26th, 2009 sonika
  173. didn´t work with 2.8.4 :(

    October 19th, 2009 helene
  174. Just used it on wordpress 2.8.4, there were some php errors originally, but if you comment out line 176 ($comments = (($overrideComments)?($overrideComments):($comments));) of the extra-comment-fields.php file, everything should work like a charm. Brilliant little plugin here, thanks for posting .’)

    October 19th, 2009 Chris
  175. Hi, how can I this plugin work with wordpress 2.8.4?

    October 19th, 2009 Fabian
  176. Great, but unfortunately I can’t seem to get the newly added text field to print to the comments list. The user is able to see and add text to the field but it then doesn’t show. Any ideas? I’m using 2.8.5

    October 22nd, 2009 Al
  177. it doesnt work on wordpress 2.8.4 admin panel but works on the comments area.

    i have added a field and it works but on the admin panel, when i click on the panel i get error:

    Warning: current() [function.current]: Passed variable is not an array or object in /home/c2013vis/public_html/wp-content/plugins/extra-comment-fields.php on line 181

    November 2nd, 2009 btoktas
  178. Would this allow me to add field input types (for uploading image)

    November 11th, 2009 Jordan Garn
  179. Doesn’t seem to work on wordpress 2.8.6 either. I’m getting these errors:

    Warning: reset() [function.reset]: Passed variable is not an array or object in /home/yitcom/public_html/officeworks/wp-content/plugins/extra-comment-fields.php on line 181

    Warning: current() [function.current]: Passed variable is not an array or object in /home/yitcom/public_html/officeworks/wp-content/plugins/extra-comment-fields.php on line 182

    November 30th, 2009 plaidfox
  180. Works on wordpress 2.8.6, you just have to follow Marco’s 2nd instructions.

    November 30th, 2009 plaidfox
  181. Before trying this plugin I have tried CformsII. It replaces the standard wordpress commentform by a homebuilt form effectively and enables inserting of extra fields…but the adding of extra fields does not work at all ! Unfortunately the support does not answer, just claiming that “it is very easy” !…
    well it is a pity this plugin has been not maintained any longer as it would meet lots of needs ! Is there a developper kind enough to publish a tutorial based on other solutions ? Regarding how long is this thread there will be no problem finding takers !

    December 7th, 2009 gaelle
  182. I was able to get it work under WP 2.8.6. However, I commented out line 176 as suggested above and I had to create the table wp_comments_extra manually with the comment_id field (type BIGINT, primary key). After that, it worked fine.

    December 9th, 2009 Scott Shumaker
  183. Warning: reset() expects parameter 1 to be array, string given in C:\wamp\www\fortest\wp-content\plugins\extra-comment-fields.php on line 181

    Warning: current() expects parameter 1 to be array, string given in C:\wamp\www\fortest\wp-content\plugins\extra-comment-fields.php on line 182

    Warning: Invalid argument supplied for foreach() in C:\wamp\www\fortest\wp-admin\edit-comments.php on line 315

    Please give me solution.. i not expert in php.

    December 15th, 2009 krahamath
  184. It doesn’t work with Wordpress 2.9 !

    January 4th, 2010 Mahmoud M. Abdel-Fattah
  185. Works great in 2.9.1 - All I had to do was comment out line 176. Database worked fine out of the box for me!

    January 5th, 2010 Jack3d
  186. Whenever someone posts a comment, it appears on the site as anonymous user but without text. Well sometimes i just don’t want to approve a comment but i don’t want to erase it aswell, but i have to, otherwise i would have posts full of anonymous comments. I commented line 176 but nothing happened. Can somebody help me??

    January 19th, 2010 Junior
  187. Line 210 (part of the query for ecf_getComments()) needs to be edited in order to work on systems with different database prefix… should be
    FROM “.$wpdb->prefix.”comments c, “.$wpdb->prefix.”comments_extra xc

    January 19th, 2010 Peter
  188. I see I’m not the first to point out the problem with database prefix; perhaps the original post could be amended to document some known issues.

    January 19th, 2010 Peter
  189. for some reason this did not work for me at all…

    Tried all the solution on the comments on the plugin Page.
    The fields do appear, but the information doesn’t get recorded on the Mysql.
    Thanks anyways.
    If there is a solution for this, please let me know..

    January 22nd, 2010 Tony Harion
  190. Don’t work in 2.9.1
    All Comments in /wp-admin/edit-comments.php have the same ID, so i can’t edit anyone … only the first one.
    And the new added fields will be empty if i save after editing a comment.

    Need help!

    January 24th, 2010 Michael
  191. Yeah it works fine in 2.9.1 if you follow Marco’s + Scott Shumaker’s instructions.
    1) replace in function ecf_getComments($comments, $post_id):
    $result = $wpdb->get_results(”SELECT xc.comment_ID, “.ecf_qryStr($fields).”
    FROM wp_comments c, wp_comments_extra xc
    WHERE c.comment_post_ID = ‘$post_id’ AND c.comment_ID = xc.comment_ID”);

    with:
    $wpdb->xc = $wpdb->prefix . ‘comments_extra’;
    $wpdb->c = $wpdb->prefix . ‘comments’;

    $sql = “SELECT xc.comment_ID, “.ecf_qryStr($fields).” FROM $wpdb->c c, $wpdb->xc xc WHERE c.comment_approved = 1 AND c.comment_post_ID = ‘$post_id’ AND c.comment_ID = xc.comment_ID”;

    $result = $wpdb->get_results($sql);

    2) Comment out line 176

    3) Manually add the “wp_comments_extra” table in your phpmyadmin and insert “comment_id” as a BIGINT and Primary Key. Then add a second field named with your label name (ex: age)

    Then, changes will be kept in Settings->Extra Comment Fields
    You will be able to insert the value, as shown in the article, by doing “extra_question; ?>” (remove space between ph and p to make it work lol)

    Yay =D

    January 26th, 2010 _Tristan

Leave a Reply