Export profile list to excel from Admin

Is there an option to export member's list from Admin to CSV / Excel file? I need to produce a list of members, few details and if they paid or not

Quote · 8 Apr 2010

Only way i know of is by using PHP my Admin through your CPanel.

If you want more info tell me to post.

Quote · 8 Apr 2010

I'll be happy if you can provide more details how to add this option in the admin

Quote · 8 Apr 2010

Just export the 'Profiles" table to Excel format using phpmyadmin in cpanel.

My opinions expressed on this site, in no way represent those of Boonex or Boonex employees.
Quote · 8 Apr 2010

Okey mate,

this is how it can be done (more or less...)

Go to your CPanel and click on the phpMyAdmin icon...once you are there, you'll see the following.

From here, of interest is the database of dolphin , so click on it.

Once in the database you'll see many table on your left... from these we need the table called "profiles".

It has a small "box" icon on it's left, which means we do not want to see the architecture of the table but the data stored inside. That is, your users.

After you click on that little box, you'll see the data stored in the database, so Click the tab named "Export", choose your settings and your file will be downloaded.

and that's it.

Cheers,

NickL

Quote · 8 Apr 2010

I know how to do it from Cpanel but since the Dolphin admin don't have access to my Cpanel therefore I want to allow him to retrieve the list and export it.

Quote · 8 Apr 2010

Sounds like you need a mod developed.

Try posting it in the Jobs section!

Cheers,

NickL

Quote · 8 Apr 2010

I found this code for people who need it:

<?php
$host = 'localhost';
$user = 'mysqlUser';
$pass = 'myUserPass';
$db = 'myDatabase';
$table = 'products_info';
$file = 'export';

$link = mysql_connect($host, $user, $pass) or die("Can not connect." . mysql_error());
mysql_select_db($db) or die("Can not connect.");

$result = mysql_query("SHOW COLUMNS FROM ".$table."");
$i = 0;
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
$csv_output .= $row['Field']."; ";
$i++;
}
}
$csv_output .= "\n";

$values = mysql_query("SELECT * FROM ".$table."");
while ($rowr = mysql_fetch_row($values)) {
for ($j=0;$j<$i;$j++) {
$csv_output .= $rowr[$j]."; ";
}
$csv_output .= "\n";
}

$filename = $file."_".date("Y-m-d_H-i",time());
header("Content-type: application/vnd.ms-excel");
header("Content-disposition: csv" . date("Y-m-d") . ".csv");
header( "Content-disposition: filename=".$filename.".csv");
print $csv_output;
exit;
?>

Quote · 8 Apr 2010

I made few little changes to profiles.php in Administration folder however my CSV creation is not showing up. Here are my changes:

1. I've created a new function

function ExportToCsv($aProfiles, $sPaginate){
$table = 'profiles';
$file = 'export';
$result = mysql_query("SHOW COLUMNS FROM ".$table."");
$i = 0;
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
$csv_output .= $row['Field'].",";
$i++;
}
}
$csv_output .= "\n";

$values = mysql_query("SELECT * FROM ".$table."");
while ($rowr = mysql_fetch_row($values)) {
for ($j=0;$j<$i;$j++) {
$csv_output .= $rowr[$j].",";
}
$csv_output .= "\n";
}

$filename = $file."_".date("Y-m-d_H-i",time());
header("Content-type: application/vnd.ms-excel");
header("Content-disposition: csv" . date("Y-m-d") . ".csv");
header( "Content-disposition: filename=".$filename.".csv");
print $csv_output;
exit;
}

2. I've added a new button under the control panel

function PageCodeMembers($sDefaultCtl = BX_DOL_ADM_MP_CTL, $sDefaultView = BX_DOL_ADM_MP_VIEW) {
//--- Get Controls ---//
$aButt alt= array(
'adm-mp-activate' => _t('_adm_btn_mp_activate'),
'adm-mp-deactivate' => _t('_adm_btn_mp_deactivate'),
'adm-mp-ban' => _t('_adm_btn_mp_ban'),
'adm-mp-unban' => _t('_adm_btn_mp_unban'),       
'adm-mp-confirm' => _t('_adm_btn_mp_confirm'),
'adm-mp-delete' => _t('_adm_btn_mp_delete'),
'adm-mp-export' => _t('_adm_btn_mp_export'),
);

3. Call to this function from the

foreach($_POST['members'] as $iId)
$bResult = profile_delete((int)$iId);
} else if(isset($_POST['adm-mp-export']) && (bool)$_POST['members']) {   
ExportToCsv("$aProfiles,", "$sPaginate");

} else if(isset($_POST['adm-mp-confirm']) && (bool)$_POST['members']) {   
foreach($_POST['members'] as $iId)

However it's not opening the file. When I'm executing it as external php program it works. I just want it to be as addition button in the admin

Any idea where I did something wrong??

Quote · 9 Apr 2010
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.