wpsharks / comment-mail

A WordPress plugin enabling email subscriptions for comments.
http://comment-mail.com
GNU General Public License v3.0
8 stars 3 forks source link

StCR Importer: Improve import for Name and Insertion IP #251

Open IvanRF opened 8 years ago

IvanRF commented 8 years ago

I noticed that after importing my StCR information, users' names were wrong (taken from the email) and they had no IP. So, I took the information I had from the wp_comments and populated the Subscriptions table. Comment author name is set as First name, and the comment author IP as the Insertion IP. Here is the SQL query:

UPDATE wp_comment_mail_subs cm 
INNER JOIN (SELECT * FROM wp_comments GROUP BY comment_author_email) c
ON c.comment_author_email = cm.email
SET cm.fname = c.comment_author, cm.insertion_ip = c.comment_author_IP

Here is a query to test before/after updating:

SELECT cm.id, cm.email, cm.fname, cm.lname, cm.insertion_ip, c.comment_author, c.comment_author_IP FROM wp_comment_mail_subs cm 
INNER JOIN (SELECT * FROM wp_comments GROUP BY comment_author_email) c
ON c.comment_author_email = cm.email
raamdev commented 8 years ago

@IvanRF Thanks! I'm marking this as something we can improve for the StCR Importer. :-)