I've been using FEU and SelfReg on a production site and have run into some problems with CSV export.
Specifically:
1) I was getting a *lot* of gaps in the output meaning that when Excel opened the CSV the data was not arranged in nice columns
2) It seemed rather slow
Looking at the code in action.do_admintasks.php...
1) Turned out to be three problems:
1a) Because the table output from the query uses DISTINCT, some rows are removed which shouldn't be. For example, a user joins and fills in two blank fields. The DISTINCT query removes all but one of these rows from the output because the only column in the query which are unique for a particular user is the user data itself.
Code: Select all
$query = "SELECT DISTINCT groupname,userid,username,createdate,expires,data FROM ".cms_db_prefix().
"module_feusers_groups A,".cms_db_prefix()."module_feusers_grouppropmap B, ".cms_db_prefix()."module_feusers_properties C,
".cms_db_prefix()."module_feusers_users D where A.id=B.group_id and C.title = B.name and C.userid = D.id
order by groupname,userid,sort_key,name
limit $start,$num";
Code: Select all
$query = "SELECT DISTINCT groupname,userid,username,createdate,expires,data,name FROM ".cms_db_prefix()."module_feusers_groups A,
".cms_db_prefix()."module_feusers_grouppropmap B,
".cms_db_prefix()."module_feusers_properties C,
".cms_db_prefix()."module_feusers_users D where A.id=B.group_id and C.title = B.name and
C.userid = D.id order by groupname,userid,sort_key,name limit $start,$num";
Code: Select all
$output .= ",".$row['data'];
Code: Select all
$output .= ",".'"'.$row['data'].'"';
Since the value doesn't exist in the database, it causes similar gaps in the output and messes up the resulting spreadsheet.
IDEAS ANYBODY?
2) The query is executed two rows at a time.
Code: Select all
$start = 0;
$num = 2; // todo, should be a preference
$done = 0;
Code: Select all
$start = 0;
$num = 200; // todo, should be a preference
$done = 0;