@@ -70,6 +70,10 @@ private function _curl_debug($curl, $echo_pre = false) {
7070 }
7171 }
7272
73+ private function _curl_header ($ curl , $ key ) {
74+ return $ curl ->responseHeaders [$ key ];
75+ }
76+
7377 private function _curl_exceptions ($ where ) {
7478 if (array_key_exists ("errors " , $ where )) {
7579 throw new Exception ($ where ["errors " ][0 ]["error_message " ], str_replace ("ERR " , "" , $ where ["errors " ][0 ]["error_code " ]));
@@ -199,7 +203,15 @@ public function user_delete($uid) {
199203 #
200204 public function usergroup_all ($ mode = "standard " ) {
201205 $ curl = $ this ->_get ("/user_groups " , ["mode " => $ mode ]);
202- return $ curl ->response ["data " ];
206+ $ max = $ this ->_curl_header ($ curl , "total_pages " );
207+ $ output = $ curl ->response ["data " ];
208+
209+ for ($ i = 2 ; $ i <= $ max ; $ i ++) {
210+ $ curl = $ this ->_get ("/user_groups " , ["mode " => $ mode , "page " => $ i ]);
211+ $ output = array_merge ($ output , $ curl ->response ["data " ]);
212+ }
213+
214+ return $ output ;
203215 }
204216
205217 public function usergroup_search ($ filters , $ mode = "standard " ) {
@@ -217,9 +229,19 @@ public function usergroup_get($ug_id, $mode = "standard") {
217229 return $ curl ->response ["data " ][0 ];
218230 }
219231
220- public function usergroup_get_members ($ ug_id , $ mode = "standard " , $ from = null , $ to = null ) {
221- $ curl = $ this ->_get ("/user_groups/ " .$ ug_id ."/user_group_memberships " , ["mode " => $ mode ]);
222- return $ curl ->response ["data " ];
232+ public function usergroup_get_members ($ ug_id , $ mode = "standard " , $ page = null , $ from = null , $ to = null ) {
233+ if ($ page == null ) { $ page = 1 ; }
234+
235+ $ curl = $ this ->_get ("/user_groups/ " .$ ug_id ."/user_group_memberships " , ["mode " => $ mode , "page " => $ page ]);
236+ $ max = $ this ->_curl_header ($ curl , "total_pages " );
237+ $ output = $ curl ->response ["data " ];
238+
239+ for ($ i = 2 ; $ i <= $ max ; $ i ++) {
240+ $ curl = $ this ->_get ("/user_groups/ " .$ ug_id ."/user_group_memberships " , ["mode " => $ mode , "page " => $ i ]);
241+ $ output = array_merge ($ output , $ curl ->response ["data " ]);
242+ }
243+
244+ return $ output ;
223245 }
224246
225247 public function usergroup_update ($ ug_id , $ data ) {
0 commit comments