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,18 +19,34 @@ ...@@ -19,18 +19,34 @@
if (!$sorted) if (!$sorted)
$sorted = 0; $sorted = 0;
if($sorted ==0){ //all users, display alphabatized if($sorted ==0){ //Last Login
if($photofilter==1){ //if Applied both condition $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"); $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;
foreach($allusers as $userall) { foreach($allusers as $userall) {
$guid = $userall->guid; $guid = $userall->guid;
//$countentity[] = get_entity($guid);
$entity = get_entity($guid); $entity = get_entity($guid);
$one = get_entity_icon_url($entity,$size ='medium'); $one = get_entity_icon_url($entity,$size ='medium');
// echo $one;echo "<br>";
if (preg_match("/defaultmedium/",$one)) { if (preg_match("/defaultmedium/",$one)) {
} else { } else {
...@@ -55,24 +71,25 @@ if($sorted ==0){ //all users, display alphabatized ...@@ -55,24 +71,25 @@ if($sorted ==0){ //all users, display alphabatized
else{ //only first condition */
else{ $baseurl= $root.'pg/browse'.'?sortresult='.$sorted;
function list_entities_sorted($type= "", $subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = false, $navigation = true,$order_by) {
$offset = (int) get_input('offset'); $nav = elgg_view('navigation/pagination',array(
$count = get_entities($type, $subtype, $owner_guid,$order_by, $limit, $offset, true); 'baseurl' => $baseurl,
$entities = get_entities($type, $subtype, $owner_guid, $order_by, $limit, $offset); 'offset' => $offset,
'count' => $count,
'limit' => $limit,
));
return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview, $viewtypetoggle, $navigation);
} foreach($allusers as $userall) {
//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);
$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.
Please register or to comment