From 84b7c560ffc09a65df896116ccd63b2f132b92b0 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Thu, 26 Jul 2018 03:52:21 -0400 Subject: Update function obj::getMembers() Added a $limit argument to specify a maximum number of results to return. --- app/class/obj.class.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'app/class/obj.class.php') diff --git a/app/class/obj.class.php b/app/class/obj.class.php index 5be9ac3..4e44649 100644 --- a/app/class/obj.class.php +++ b/app/class/obj.class.php @@ -144,12 +144,17 @@ class obj extends table } /* - * Get an array of all members of this object + * Get an array of all members of this object. Limit of zero + * returns all members. */ - public function getMembers() : array + public function getMembers(int $limit = 0) : array { $memb = array(); $query = "SELECT member FROM members WHERE guid = '" . database::esc($this->guid) . "'"; + + if ($limit != 0) + $query .= " LIMIT " . database::esc($limit); + $res = database::query($query); foreach ($res as $m) -- cgit v1.2.3