aboutsummaryrefslogtreecommitdiffstats
path: root/include/api_zot.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2016-11-13 23:28:03 -0800
committerzotlabs <mike@macgirvin.com>2016-11-13 23:28:03 -0800
commitcf5c803fe0ebd976031584ee788eb5d762e8a798 (patch)
tree3ec17536e5807ed2970fe6a370e8b65b0ce8fa9a /include/api_zot.php
parent3c302bae5ac71c1853d33117f9bbcfc0e5d81651 (diff)
downloadvolse-hubzilla-cf5c803fe0ebd976031584ee788eb5d762e8a798.tar.gz
volse-hubzilla-cf5c803fe0ebd976031584ee788eb5d762e8a798.tar.bz2
volse-hubzilla-cf5c803fe0ebd976031584ee788eb5d762e8a798.zip
api: allow group member list to use a group name or id
Diffstat (limited to 'include/api_zot.php')
-rw-r--r--include/api_zot.php30
1 files changed, 16 insertions, 14 deletions
diff --git a/include/api_zot.php b/include/api_zot.php
index 42b8315ad..2390bb4c2 100644
--- a/include/api_zot.php
+++ b/include/api_zot.php
@@ -46,8 +46,6 @@
logger('api_export_basic: no user');
return false;
}
-
- require_once('include/channel.php');
json_return_and_die(identity_basic_export(api_user(),(($_REQUEST['posts']) ? intval($_REQUEST['posts']) : 0 )));
}
@@ -215,30 +213,34 @@
killme();
}
-
-
function api_group_members($type) {
if(api_user() === false)
return false;
+ $r = null;
+
if($_REQUEST['group_id']) {
$r = q("select * from groups where uid = %d and id = %d limit 1",
intval(api_user()),
intval($_REQUEST['group_id'])
);
- if($r) {
- $x = q("select * from group_member left join xchan on group_member.xchan = xchan.xchan_hash
- left join abook on abook_xchan = xchan_hash where gid = %d",
- intval($_REQUEST['group_id'])
- );
- json_return_and_die($x);
- }
}
- }
-
-
+ elseif($_REQUEST['group_name']) {
+ $r = q("select * from groups where uid = %d and gname = '%s' limit 1",
+ intval(api_user()),
+ dbesc($_REQUEST['group_name'])
+ );
+ }
+ if($r) {
+ $x = q("select * from group_member left join xchan on group_member.xchan = xchan.xchan_hash
+ left join abook on abook_xchan = xchan_hash where gid = %d",
+ intval($r[0]['id'])
+ );
+ json_return_and_die($x);
+ }
+ }
function api_group($type) {
if(api_user() === false)