Any way to export users?

Permalink
I thought I was done with my C5 site and the client just asked for a feature that they assumed would be available. They want to be able to extract all the user data into a file (either csv or excel file). Is there any way to do this? It looks like from looking at google there used to be a way to do this in c5 but it appears to be ripped out (I couldn't find it anyway).

Any ideas on how to do this? I would greatly appreciate any help on this.

 
Tony replied on at Permalink Reply
Tony
not sure what kind of format you need it in, but check out the UserList class. That'll make it easy to grab all the users.
kino replied on at Permalink Reply
kino
What is it all data?
dg1 replied on at Permalink Reply
They would probably love it if it could be any data but they will settle for all data in a csv or excel file. I found in the documentation that there used to be a "Export" button on the user page. I wish it was still there. Do you know why it was removed? I assume I could probably get a copy of the old code and integrate it somehow?

I'm kind of panicking here because I thought I was done and I didn't expect this last minute request.

I'll look at UserList as Tony recommends but I was hoping there was a solution already (wishful thinking).
Tony replied on at Permalink Reply
Tony
hey, good news. concrete5.4, isn't officially released yet, but it has an easy way export users to an excel spreadsheet in there already! have a look at the beta version in svn.
dg1 replied on at Permalink Reply
That is fantastic! Unfortunately, I can't wait until 5.4 because my customer is going to go live soon but I will install it and see if I can leverage the code for now until 5.4 comes out officially. Thanks so much!
dg1 replied on at Permalink Reply
Ok dumb question. I can't find how to get the beta version of 5.4. I couldn't see it anywhere on this site or sourceforge. Do I have to join the beta program? Thanks.
Tony replied on at Permalink Reply
Tony
the beta's kind of a mess right now, so just grab the code you need from here and copy it over:
http://svn.concrete5.org/svn/concrete5/...
ecoit replied on at Permalink Reply
hi .. i can't find the CSV export code anywhere in 5.4 .. can someone please point me in the right direction? it's pretty urgent ..
thanks in advance !
dg1 replied on at Permalink Reply
I also could not find it in 5.4. I gave up and installed 5.2 which had some code in there to export users (part of the dashboard). I ended up creating a single page with the export code and a controller which I based on the members controller. Here is part of my export code in my single page (this creates an excel file):

<?php  defined('C5_EXECUTE') or die(_("Access Denied.")); ?>
<div id="ccm-profile-wrapper">
   <?php  if ($userList->getTotal() == 0) { ?>
      <div><?php echo t('No users found.')?></div>
   <?php  } 
   else {   
        header("Content-Type: application/vnd.ms-excel");
        header("Cache-control: private");
   header("Pragma: public");
   $date = date('Ymd');
   header("Content-Disposition: inline; filename=user_report_{$date}.xls"); 
   header("Content-Title: User Report - Run on {$date}");
   echo("<table><tr>");
   //echo("<td><b>".t('Username')."</b></td>");
   echo("<td><b>".t('Email Address')."</b></td>");


I hope this helps.