GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   wordpress tip: extract all comment emails for mailing (https://gfy.com/showthread.php?t=880689)

fris 01-10-2009 09:57 AM

wordpress tip: extract all comment emails for mailing
 
I dont recommend spamming your blog users, but sometimes you may want to send information to your readers, many of you might use a wordpress plugin for a mailing list or an external program which can import a list.

Here is a small snippet of code which will print out all your comment author's emails.

Code:

<?php

$db_host = "localhost";
$db_user = "username";
$db_password = "password";
$db_name = "database";

$connect=mysql_connect($db_host,$db_user,$db_password) or die(mysql_error());
$db=mysql_select_db($db_name, $connect) or die(mysql_error());

$result=mysql_query("select comment_author_email from wp_comments");
while($row=@mysql_fetch_assoc($result))
{
        $email=$row[comment_author_email];
        echo $email;
}

?>

:thumbsup

2012 01-10-2009 10:01 AM

:thumbsup

Donfoolio 01-10-2009 10:04 AM

Nice thank you! :thumbsup

Ethersync 01-10-2009 10:06 AM

Another excellent tip from our resident WordPress guru :thumbsup

Si 01-10-2009 11:17 AM

:thumbsup

Sosa 01-10-2009 11:28 AM

good stuff fris

camgirlshide 01-10-2009 12:24 PM

Did you put a message on the site that says leaving a comment signs you up for a mailing list and have some opt out method?

papill0n 01-10-2009 03:15 PM

nice fris :thumbsup

st0ned 01-10-2009 04:16 PM

Another great thread from fris! You are on a roll lately, hit me up sometime lets do some biz. :thumbsup

BigBen 01-10-2009 06:26 PM

Quality posts lately. :thumbsup

Here's another way using built-in WP functions so you don't have to mess with the mysql stuff (tested in 2.7):

Code:

<?php
require_once('example.com/wp-load.php');

$email_list = $wpdb->get_results("SELECT DISTINCT comment_author_email FROM $wpdb->comments WHERE comment_author_email != ''");
foreach($email_list as $email) {
        echo $email->comment_author_email . "\n";
}


fris 01-11-2009 05:57 AM

good one ben ;)

XX_RydeR 01-11-2009 06:17 AM

Ah nice tip.

Though i wouldnt go sending them any type of message without first putting up something about
it on the blog, Terms or what not.

Zuzana Designs 01-11-2009 10:00 AM

Nice seeing some bizz on the board.. Thanks Fris ..

pr0 01-11-2009 10:03 AM

Quote:

Originally Posted by BigBen (Post 15309737)
Quality posts lately. :thumbsup

Here's another way using built-in WP functions so you don't have to mess with the mysql stuff (tested in 2.7):

Code:

<?php
require_once('example.com/wp-load.php');

$email_list = $wpdb->get_results("SELECT DISTINCT comment_author_email FROM $wpdb->comments WHERE comment_author_email != ''");
foreach($email_list as $email) {
        echo $email->comment_author_email . "\n";
}


pwnd :thumbsup


All times are GMT -7. The time now is 01:57 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123