Skip to content

Instantly share code, notes, and snippets.

@kbrmedia
Last active January 31, 2019 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kbrmedia/928548f840d64f5420944e6c62faccde to your computer and use it in GitHub Desktop.
Save kbrmedia/928548f840d64f5420944e6c62faccde to your computer and use it in GitHub Desktop.
User List for Premium URL Shortener
<?php
// Get users list who have their profile set to public
$users = $this->db->get("user", ["public" => "1"], ["limit"=>(($this->page-1)*$this->limit).", {$this->limit}","count"=>TRUE]);
// Generate Pagination
if(($this->db->rowCount%$this->limit)<>0) {
$max=floor($this->db->rowCount/$this->limit)+1;
} else {
$max=floor($this->db->rowCount/$this->limit);
}
if($this->page > 1 && $this->page > $max) Main::redirect("user",array("danger","No members found."));
// Replace __THEPAGE__ by the page handler so if your handler is "members" replace by members
// To output pagination use echo $pagination
$pagination = Main::pagination($max,$this->page,Main::href("___THEPAGE__?page=%d"));
// Then in your template
foreach($users as $user){
// Rest of the code
echo $user->username;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment