How to Extract commentators Email address with IP & Name from a post in WordPress [Featured]

by Mayur on August 22, 2010

in Blogging, How To's

WP If you’re a blog administrator who frequently organises giveaway and contest, then you’ll find this article really helpful. Making a comment by participants is necessary in most of the giveaways and it becomes really difficult for site admin to randomly draw the winners, if the comments are in large number.

An exclusive way is discovered by us which will allow you to extract the email addresses, IP address and Name of all commentators from a specific post in WordPress.org.

Follow the step by step tutorial below carefully to extract Email address:

1. Login to cPanel (of your blog host).

2. Go to phpMyAdmin under Databases section.

3. Select your blog database from the left panel which may be marked as _wrdp1

select your database

4. Click on wp_comments from table in left hand side.

click on wp_comments

5. Now click on “Search” tab.

6. Open Options (in blue), Select comment_author, comment_author_email and comment_author_ip in the fields box. Tick mark ‘DISTINCT’ to remove the exactly similar entries (those with same name, email and IP address).

set parameters in Search

7. Input comment_post_id = xxxx under "Add search conditions (body of the "where" clause):" Replace xxxx with the post ID.

To find Post ID of a post, just login to your blog’s WordPress dashboard. Open ‘Posts’ and point your mouse over the preferred post. You’ll then see a link in the status bar of browser. Just note the no. next to post=xxx (For eg: Here it is 7260) as shown below:

find post id

8. Set Number of rows per page to 1000

9. Display order Ascending

10. Click ‘GO’ button. All queries will be sorted now.

11. Click Export button, select ‘CSV for MS Excel’ and tick mark ‘Save as file’. Click GO.

choose export format

A MS Excel file will now be produced containing all the commentators name, IP and email address from a certain post. You can then find duplicate email and IP addresses and sort the invalid ones using Excel. Then you can copy all the email addresses and use Random.org to draw the giveaway winners.

This guide looks difficult in starting but you’ll find it really easy, once you get used to it. This post is specially for bloggers who conduct big giveaways on their blog. :D

Do share this tutorial if you find it useful.

Update – Sandip of BlogsDNA has provided us a source code which eliminates 6 steps and makes it real easy to do this task. :D Check below how to do it:

Go to phpMyAdmin and select your blog database. Now click on “SQL” tab. Input the below SQL query there and click the ‘Go’ button. You’ll now come straight to Step 11.

SELECT DISTINCT comment_author, comment_author_email, comment_author_IP
FROM (
SELECT DISTINCT comment_author, comment_author_email, comment_author_IP
FROM wp_comments
WHERE `comment_post_ID` = ‘xxxx’
) AS WEBTRICKZ

Remember to Replace xxxx with your Post ID.

Related Posts:

Liked this article? Then SUBSCRIBE to RSS Feed or get Free updates via E-MAIL



{ 10 comments… read them below or add one }

Leave a Comment

{ 1 trackback }

Previous post:

Next post:

   Copyright © 2008-2014 WebTrickz | Google+ | Sitemap | Privacy Policy | Advertise | Back To Top