thanks for reminding me. Here is the code I’m using. I don’t remember how much I modified your code – maybe just added in the paging stuff?
<?php
define("JONDALEY_EMAIL_MAX_USERS",10000);
function jondaley_get_users_info($role, $pageNum=0){
$ret = array();
if(!$role)
return $ret;
$columns = array("Registered Date" => "user_registered",
"Email address" => "user_email",
"Login ID" => "user_login",
"Display Name" => "display_name",
"URL" => "user_url");
$group_users = get_users(array('role' => $role,
'offset' => $pageNum*JONDALEY_EMAIL_MAX_USERS,
'number'=> JONDALEY_EMAIL_MAX_USERS));
$ret['columns'] = $columns;
foreach($group_users as $user){
foreach($columns as $column){
$user_info[$column] = $user->$column;
}
$ret['users'][] = $user_info;
}
return $ret;
}
function jondaley_list_emails(){
$roles = get_editable_roles();
print "Find: ";
foreach($roles as $roleId => $role){
print "<a href='".add_query_arg(array('role' => $roleId, 'pageNum' => 0))."'>".$role['name']."s</a> ";
}
print "<br/>";
$role = isset($_GET['role']) ? $_GET['role'] : '';
$pageNum = isset($_GET['pageNum']) ? preg_replace("[^0-9]", "", $_GET['pageNum']) : '';
if(!$role || !array_key_exists($role, $roles))
return;
print "Searching for ${role}s...<br/>";
$infos = jondaley_get_users_info($role, $pageNum);
print "<pre>";
foreach($infos['columns'] as $column_header => $unused){
print $column_header . "\t";
}
print "<br/>";
foreach ($infos['users'] as $user) {
foreach($infos['columns'] as $column){
print $user[$column] . "\t";
}
print "<br/>";
};
print "</pre>";
if(count($infos['users']) == JONDALEY_EMAIL_MAX_USERS)
print "<a href='".add_query_arg('pageNum',$pageNum+1)."'>Next Page</a><br />\n";
}