Last active
January 31, 2019 19:45
-
-
Save kbrmedia/928548f840d64f5420944e6c62faccde to your computer and use it in GitHub Desktop.
User List for Premium URL Shortener
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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