From 8dec126e7dd19ebb068b1a4f42804f8c0205af9d Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Mon, 30 Mar 2020 10:26:46 -0700 Subject: add channel selection to event interface --- lib/helpers.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/helpers.php') diff --git a/lib/helpers.php b/lib/helpers.php index 695ca27..48ada12 100644 --- a/lib/helpers.php +++ b/lib/helpers.php @@ -269,6 +269,7 @@ function parse_headers($headers) { function get_micropub_config(&$user, $query=[]) { $targets = []; + $channels = []; $r = micropub_get($user->micropub_endpoint, $query, $user->micropub_access_token); if($r['data'] && is_array($r['data']) && array_key_exists('syndicate-to', $r['data'])) { @@ -295,8 +296,13 @@ function get_micropub_config(&$user, $query=[]) { } } + if($r['data'] && is_array($r['data']) && array_key_exists('channels', $r['data']) && is_array($r['data']['channels'])) { + $channels = $r['data']['channels']; + } + // Reset the values so they can be overwritten $user->syndication_targets = ''; + $user->channels = ''; $user->supported_post_types = ''; $user->supported_visibility = ''; $user->micropub_media_endpoint = ''; @@ -304,6 +310,9 @@ function get_micropub_config(&$user, $query=[]) { if(count($targets)) $user->syndication_targets = json_encode($targets); + if(count($channels)) + $user->channels = json_encode($channels); + $media_endpoint = false; $supported_post_types = false; if($r['data'] && is_array($r['data'])) { @@ -325,6 +334,7 @@ function get_micropub_config(&$user, $query=[]) { return [ 'targets' => $targets, + 'channels' => $channels, 'response' => $r ]; } -- cgit v1.2.3