4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: steveeyes on December 19, 2005, 07:47:17 AM
-
I use the 4images usergroup mod. It's great to be able to separate your usergroups and email them, etc.
However, as my memberships have grown, I have been forced to search out another way to email my members. The reason being is that my server only allows me to send 50 emails at a time -- and now it is taking too long to send out newsletters.
I thought at one time I saw this mod by V@NO but maybe I'm wrong. I searched but didn't find anything.
I'm hoping an expert could tell me the code to extract the emails by usergroups into csv format or another format that can be imported into a newsletter program.
I have two usergroups ... one called Ladies and the other Called Men
I would like to extract the Usergroup Ladies emails and then import them into a mailing list that would also be called Ladies.
The same thing for the Men Usergroup -- extract emails from usergroup and import into mailing list called men
Any help would be appreciated.
Thanks
Steve
-
Any help, please
-
@Steveeyes:
Since yesterday, your MOD has been completely done and fully tested. You may PM me if you wish to have it.
Merry Christmas.
-
Thank you sir, thank you sir. Not sure if you got my PM, but your efforts are appreciated.
Merry Christmas
Steve
-
PM replied. ;)
-
TheOracle, I have the same problem
PM sent
-
PM Received. ;)
-
Can Anyone else make this mod? Maybe like a plugin for the Admin CP
thanks
-
<?php // PLUGIN_TITLE: email to csv
$nozip = 1;
define('IN_CP', 1);
define('ROOT_PATH', "./../../");
define('ROOT_PATH_ADMIN', "./../");
require(ROOT_PATH_ADMIN.'admin_global.php');
$anzahl = 0;
global $site_db;
$sql = "SELECT user_email, user_name
FROM ".USERS_TABLE."
WHERE user_allowemails=1";
$result = $site_db->query($sql);
$anz = mysql_num_rows ($result);
$fp=fopen('emails/adressen.csv','w+');
while ($sql_array = mysql_fetch_array($result, MYSQL_NUM))
{
$text = implode(' ; ', $sql_array) . " ; \n";
fwrite($fp,$text);
}
fclose($fp);
print "<a href=\"".ROOT_PATH_ADMIN."plugins/emails/adressen.csv\">Download</a>";
?>
create a folder emails with chmod 777 into the plugin folder...
after use you found a csv file in the folder with the emails form the users that allows mails from the admin...
-
Thanks Acidgod
That worked perfectly 8)
U saved me a bunch of time not having to send 50 emails at a time
-
have make a littel modification, now there is a link to the csv file at the end of the script...
-
Thats even better 8)
Thanks again
-
please rename the email folder or the cvs file in the plugin...
or put a htaccess file in the email folder... (o:
Here:
$fp=fopen('emails/adressen.csv','w+');
And here:
print "<a href=\"".ROOT_PATH_ADMIN."plugins/emails/adressen.csv\">Download</a>";
otherwise anyone can grab the List of emails... (o:
-
:wink:
-
@Acidgod:
I just noticed some unusual codings in your plugin. Modifications has just been made as I hope you won't mind :
<?php // PLUGIN_TITLE: email to csv
$nozip = 1;
define('IN_CP', 1);
define('ROOT_PATH', "./../../");
define('ROOT_PATH_ADMIN', "./../");
require(ROOT_PATH_ADMIN.'admin_global.php');
show_admin_header();
$anzahl = 0;
$sql = "
SELECT ".get_user_table_field("", "user_name"). get_user_table_field(", ", "user_email")."
FROM ".USERS_TABLE."
WHERE user_allowemails = '1'
";
$result = $site_db->query($sql);
$anz = $site_db->get_numrows($result);
if ($anz) {
$fp = @fopen('emails/adressen.csv', 'w+');
while ($sql_array = $site_db->fetch_array($result, MYSQL_NUM)) {
$text = implode(' ; ', $sql_array) . " ; \n";
@fwrite ($fp, $text);
} ###### End of while statement.
@fclose($fp);
echo "<a href=\"".$site_sess->url(ROOT_PATH_ADMIN."plugins/emails/adressen.csv")."\">".$lang['download']."</a>";
} ###### End of if statement.
show_admin_footer();
?>
;)
-
Working perfect like a norwegian girl :)
-
a norwegian girl
Now, that's one good example. :mrgreen:
-
This looks OUTSTANDING!
I would like to modify it to retrieve all sender & recipient email addresses from the ecards. I tried the following code, but it crashes out.
<?php // PLUGIN_TITLE: Ecard Emails
$nozip = 1;
define('IN_CP', 1);
define('ROOT_PATH', "./../../");
define('ROOT_PATH_ADMIN', "./../");
require(ROOT_PATH_ADMIN.'admin_global.php');
show_admin_header();
$anzahl = 0;
$sql = "SELECT ".get_user_table_field("", "postcard_recipient_email"). get_user_table_field(", ", "postcard_sender_email")."
FROM ".POSTCARDS_TABLE."";
//WHERE user_allowemails = '1'";
$result = $site_db->query($sql);
$anz = $site_db->get_numrows($result);
if ($anz) {
$fp = @fopen('all-ecard-addresses/list.csv', 'w+');
while ($sql_array = $site_db->fetch_array($result, MYSQL_NUM)) {
$text = implode(' ; ', $sql_array) . " ; \n";
@fwrite ($fp, $text);
} ###### End of while statement.
@fclose($fp);
echo "<a href=\"".$site_sess->url(ROOT_PATH_ADMIN."plugins/all-ecard-addresses/list.csv")."\">".$lang['download']."</a>";
} ###### End of if statement.
show_admin_footer();
?>
The error for the above code is:
DB Error: Bad SQL Query: SELECT FROM 4users
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 'FROM 4users' at line 2
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/stick/public_html/ecards/includes/db_mysql.php on line 116
Still investigating, but would appreciate any help you could provide. Thanks!!!
Special thanks to TheOracle!
-
This looks OUTSTANDING!
I would like to modify it to retrieve all sender & recipient email addresses from the ecards. I tried the following code, but it crashes out.
<?php // PLUGIN_TITLE: Ecard Emails
$nozip = 1;
define('IN_CP', 1);
define('ROOT_PATH', "./../../");
define('ROOT_PATH_ADMIN', "./../");
require(ROOT_PATH_ADMIN.'admin_global.php');
show_admin_header();
$anzahl = 0;
$sql = "SELECT ".get_user_table_field("", "postcard_recipient_email"). get_user_table_field(", ", "postcard_sender_email")."
FROM ".POSTCARDS_TABLE."";
//WHERE user_allowemails = '1'";
$result = $site_db->query($sql);
$anz = $site_db->get_numrows($result);
if ($anz) {
$fp = @fopen('all-ecard-addresses/list.csv', 'w+');
while ($sql_array = $site_db->fetch_array($result, MYSQL_NUM)) {
$text = implode(' ; ', $sql_array) . " ; \n";
@fwrite ($fp, $text);
} ###### End of while statement.
@fclose($fp);
echo "<a href=\"".$site_sess->url(ROOT_PATH_ADMIN."plugins/all-ecard-addresses/list.csv")."\">".$lang['download']."</a>";
} ###### End of if statement.
show_admin_footer();
?>
The error for the above code is:
DB Error: Bad SQL Query: SELECT FROM 4postcards
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 'FROM 4postcards' at line 2
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/stick/public_html/ecards/includes/db_mysql.php on line 116
Still investigating, but would appreciate any help you could provide. Thanks!!!
Special thanks to TheOracle!
-
Ok...
With valuable help from TheOracle (thank you!), this is working very well for extracting the emails from ecards. Here's the code I'm using:
<?php // PLUGIN_TITLE: Ecard Emails
$nozip = 1;
define('IN_CP', 1);
define('ROOT_PATH', "./../../");
define('ROOT_PATH_ADMIN', "./../");
require(ROOT_PATH_ADMIN.'admin_global.php');
show_admin_header();
$anzahl = 0;
$sql = "SELECT postcard_recipient_email, postcard_sender_email
FROM ".POSTCARDS_TABLE."";
$result = $site_db->query($sql);
$anz = $site_db->get_numrows($result);
if ($anz) {
$fp = @fopen('addresses/emails.csv', 'w+');
while ($sql_array = $site_db->fetch_array($result, MYSQL_NUM)) {
$text = implode("," , $sql_array) . ",";
$list = str_replace("," , "\n" , $text);
@fwrite ($fp, $list);
} ###### End of while statement.
@fclose($fp);
echo "<a href=\"".$site_sess->url(ROOT_PATH_ADMIN."plugins/addresses/emails.csv")."\">Download</a>";
} ###### End of if statement.
show_admin_footer();
?>