Hi,
Is there a mod to export users e-mails to a text file?
I want to import the e-mails into a mailinglist program.
I saw a similar mod for phpBB:
<?php
/***************************************************************************
* admin_export_emails.php
* -------------------
* begin : Saturday, July 31, 2006
* copyright : (C) Funender.com
*
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
define('IN_PHPBB', 1);
if( !empty($setmodules) )
{
$file = basename(__FILE__);
$module['Users']['Export_Emails'] = $file;
return;
}
//
// Let's set the root dir for phpBB
//
$phpbb_root_path = "./../";
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
//
// Begin Email Export
//
export_email($HTTP_POST_VARS['search_username']);
function export_email($emails_found)
{
global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path;
if ( !empty($emails_found) )
{
$export_email = preg_replace('/\*/', '%', trim(strip_tags($emails_found)));
$sql = "SELECT *
FROM " . USERS_TABLE . "
WHERE user_email != '';";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain emails', '', __LINE__, __FILE__, $sql);
}
if ( $row = $db->sql_fetchrow($result) )
{
do
{
$export_list .= $row['user_email'] . '<br />';
}
while ( $row = $db->sql_fetchrow($result) );
}
else
{
message_die(GENERAL_ERROR, 'Could not obtain emails');
}
$db->sql_freeresult($result);
}
$page_title = $lang['Export_Emails_Title'];
$template->set_filenames(array(
"body" => "admin/export_emails.tpl")
);
$template->assign_vars(array(
'L_EXPORT_EMAILS_PAGE' => $lang['Export_emails_page'],
'L_EXPORT_EMAILS_EXPLAIN' => $lang['Export_emails_explain'],
'L_EXPORT_EMAILS_HEADER' => $lang['Export_emails_header'],
'L_EXPORT' => $lang['Export'],
'S_EXPORT_LIST' => $export_list,
'S_EXPORT_ACTION' => append_sid("admin_export_emails.$phpEx"))
);
if ( $export_list != '' )
{
$template->assign_block_vars('export_email_list', array());
}
$template->pparse("body");
include('./page_footer_admin.'.$phpEx);
}
?>
Can someone do this very important MOD?
Cheers,
cruxy