4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: geewhiz on April 03, 2003, 06:38:12 PM

Title: Email List Extraction
Post by: geewhiz on April 03, 2003, 06:38:12 PM
Does someone have a simple utility that can easily extract the *validated* user names & email address from 4Images?

We would like to generate a mail out that is HTML and as such find that the embedded process does not work for us.

Thanks,
Title: Email List Extraction
Post by: V@no on April 03, 2003, 06:58:52 PM
create a .php file with this code:
Code: [Select]
<?php
define
&#40;'ROOT_PATH', './4images/'&#41;;
include&#40;ROOT_PATH.'global.php'&#41;;
$sql "SELECT user_name, user_email, user_allowemails
        FROM "
.USERS_TABLE." c
        WHERE user_allowemails <> 0
        ORDER BY user_name ASC"
;
$result $site_db->query&#40;$sql&#41;;
$users = array&#40;&#41;;
while &#40;$row = $site_db->fetch_array&#40;$result&#41;&#41; &#123;
$users[&#93; = array&#40;$row['user_name'&#93;, $row['user_email'&#93;&#41;;
&#125;
foreach &#40;$users as $key => $val&#41; &#123;
echo $val[0&#93;." - ".$val[1&#93;."<br />";
&#125;
?>

then, change ROOT_PATH .
this wont show users/emails who set "do not receive emails from admin" to yes.
Title: Email List Extraction
Post by: geewhiz on April 03, 2003, 08:54:04 PM
Thanks V@no, I will give it a try and let you know.

[edit]
Works like a charm!  :D

Thanks again.
Title: Email List Extraction
Post by: Caelestis on April 04, 2003, 12:00:48 AM
If phpbb is intergrated... just as v@no's change the rootpath but this one show all users

Code: [Select]
<?php 
define
&#40;'ROOT_PATH', './'&#41;; 
include&#40;ROOT_PATH.'global.php'&#41;; 
$sql "SELECT username, user_email 
        FROM "
.USERS_TABLE." c 
        ORDER BY username ASC"

$result $site_db->query&#40;$sql&#41;; 
$users = array&#40;&#41;; 
while &#40;$row = $site_db->fetch_array&#40;$result&#41;&#41; &#123; 
   
$users[&#93; = array&#40;$row['username'&#93;, $row['user_email'&#93;&#41;; 
&#125; 
foreach &#40;$users as $key => $val&#41; &#123; 
   
echo $val[0&#93;." - ".$val[1&#93;."<br />"; 
&#125; 
?>
Title: Email List Extraction
Post by: geewhiz on April 04, 2003, 02:06:06 AM
Quote from: Caelestis
If phpbb is intergrated...


I wish it was  :( but not at this time, however thanks for the code I will hang on to it for that "very day".

Thanks