File tree 1 file changed +33
-0
lines changed
1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -363,5 +363,38 @@ public static function listSubscribers($list_id = 0)
363
363
die (0 );
364
364
}
365
365
366
+ /**
367
+ * Get num of subscribers from a list
368
+ *
369
+ * <p><strong>Parameters:</strong><br/>
370
+ * [*list_id] {integer} the List-ID.
371
+ * <p><strong>Returns:</strong><br/>
372
+ * List_id and count of subscriber.
373
+ * </p>
374
+ */
375
+ public static function listSubscribersCount ($ list_id = 0 )
376
+ {
377
+ $ response = new Response ();
378
+ if ($ list_id == 0 ) {
379
+ $ list_id = sprintf ('%d ' , $ _REQUEST ['list_id ' ]);
380
+ }
381
+ $ sql = 'SELECT listid, COUNT(*) AS count FROM ' .$ GLOBALS ['tables ' ]['listuser ' ].' WHERE listid=:list_id; ' ;
382
+ if (!is_numeric ($ list_id ) || empty ($ list_id )){
383
+ Response::outputErrorMessage ('invalid call ' );
384
+ }
385
+ try {
386
+ $ db = PDO ::getConnection ();
387
+ $ stmt = $ db ->prepare ($ sql );
388
+ $ stmt ->bindParam ('list_id ' , $ list_id , PDO ::PARAM_INT );
389
+ $ stmt ->execute ();
390
+ $ result = $ stmt ->fetch (PDO ::FETCH_OBJ );
391
+ $ db = null ;
392
+ $ response ->setData ('SubscribersCount ' , $ result );
393
+ $ response ->output ();
394
+ } catch (\Exception $ e ) {
395
+ Response::outputError ($ e );
396
+ }
397
+ }
398
+
366
399
367
400
}
You can’t perform that action at this time.
0 commit comments