+function communityhome_getopts() {
+ return [
+ 'hidelogin'=>t('Hide login form'),
+ 'showlastusers'=>t('Show last new users'),
+ 'showactiveusers'=>t('Show last active users'),
+ 'showlastphotos'=>t('Show last photos'),
+ 'showlastlike'=>t('Show last liked items'),
+ 'showcommunitystream'=>t('Show community stream')
+ ];
+}
+
+function communityhome_plugin_admin(&$a, &$o) {
+ $tpl = get_markup_template( 'settings.tpl', 'addon/communityhome/' );
+
+ $opts = communityhome_getopts();
+ $ctx = [
+ '$submit' => t("Submit"),
+ '$fields' => [],
+ ];
+ foreach($opts as $k=>$v) {
+ $ctx['fields'][] = ['communityhome_'.$k, $v, Config::get('communityhome', $k)];
+ }
+ $o = replace_macros($tpl, $ctx);
+}
+
+function communityhome_plugin_admin_post(&$a,&$b) {
+ if(x($_POST,'communityhome-submit')) {
+ $opts = communityhome_getopts();
+ foreach($opts as $k=>$v) {
+ Config::set('communityhome', $k, x($_POST,'communityhome_'.$k));
+ }
+ }
+}
+
+