Skip to content
Snippets Groups Projects
Commit a653b0de authored by Seth Meranda's avatar Seth Meranda
Browse files

Added a function to get a list of users alphabatized by name.

parent 2067eb4d
No related branches found
No related tags found
No related merge requests found
......@@ -19,24 +19,40 @@
if (!$sorted)
$sorted = 0;
if($sorted ==0){ //all users, display alphabatized
if($sorted ==0){ //Last Login
if($photofilter==1){ //if Applied both condition
$allusers = get_data("select a.guid from {$CONFIG->dbprefix}users_entity as a,{$CONFIG->dbprefix}entities as b where a.guid =b.guid and b.enabled = 'yes' order by a.name ASC");
echo $allusers;
$totalCount= get_data("select a.guid from {$CONFIG->dbprefix}users_entity as a,{$CONFIG->dbprefix}entities as b where a.guid =b.guid and b.enabled = 'yes' order by a.name ASC");
//exit;
$offset=get_input('offset');
if(empty($offset))
$offset = 0;
$root = $CONFIG->wwwroot;
$limit =10;
$end = $limit;
$allusers = get_data("select a.guid from {$CONFIG->dbprefix}users_entity as a,{$CONFIG->dbprefix}entities as b where a.guid =b.guid and b.enabled = 'yes' order by a.name ASC limit $offset,$end");
$count = sizeof($totalCount);
if($photofilter==1){ //if Applied both condition
$allusers = get_data("select a.guid from {$CONFIG->dbprefix}users_entity as a,{$CONFIG->dbprefix}entities as b where a.guid =b.guid and b.enabled = 'yes' order by a.name ASC");
foreach($allusers as $userall) {
$guid = $userall->guid;
//$countentity[] = get_entity($guid);
$entity = get_entity($guid);
$one = get_entity_icon_url($entity,$size ='medium');
// echo $one;echo "<br>";
if (preg_match("/defaultmedium/",$one)) {
} else {
$result .= elgg_view_entity($entity,$fullview);
$countentity[] = $entity;
}
}
......@@ -50,32 +66,33 @@ if($sorted ==0){ //all users, display alphabatized
'count' => $count,
'limit' => $limit,
));
}
else{
function list_entities_sorted($type= "", $subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = false, $navigation = true,$order_by) {
$offset = (int) get_input('offset');
$count = get_entities($type, $subtype, $owner_guid,$order_by, $limit, $offset, true);
$entities = get_entities($type, $subtype, $owner_guid, $order_by, $limit, $offset);
return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview, $viewtypetoggle, $navigation);
}
//name
$order_by ="time_updated DESC";
//$order_by ="name ASC";
$result = list_entities_sorted('user', $subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = false, $navigation = true,$order_by);
}
else{ //only first condition */
$baseurl= $root.'pg/browse'.'?sortresult='.$sorted;
$nav = elgg_view('navigation/pagination',array(
'baseurl' => $baseurl,
'offset' => $offset,
'count' => $count,
'limit' => $limit,
));
foreach($allusers as $userall) {
$guid = $userall->guid;
$entity = get_entity($guid);
$result .= elgg_view_entity($entity,$fullview);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment