From 9bfa5c82d19ce42bfb283c35f31518cca461349f Mon Sep 17 00:00:00 2001
From: Mario Vavti <mario@mariovavti.com>
Date: Sat, 6 Oct 2018 18:29:32 +0000
Subject: move profile assign selector to profile settings and personal menu
 selector to channel_home settings and get rid of misc channel settings
 section.

(cherry picked from commit 66cf0852728d2f95ed3a5b7a304dbc7b79111831)
---
 Zotlabs/Module/Settings/Channel_home.php | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

(limited to 'Zotlabs/Module/Settings/Channel_home.php')

diff --git a/Zotlabs/Module/Settings/Channel_home.php b/Zotlabs/Module/Settings/Channel_home.php
index 0e916d530..b6ecf4ff1 100644
--- a/Zotlabs/Module/Settings/Channel_home.php
+++ b/Zotlabs/Module/Settings/Channel_home.php
@@ -2,6 +2,7 @@
 
 namespace Zotlabs\Module\Settings;
 
+require_once('include/menu.php');
 
 class Channel_home {
 
@@ -18,8 +19,10 @@ class Channel_home {
 		$channel_divmore_height = ((x($_POST,'channel_divmore_height')) ? intval($_POST['channel_divmore_height']) : 400);
 		if($channel_divmore_height < 50)
 			$channel_divmore_height = 50;
-
 		set_pconfig(local_channel(),'system','channel_divmore_height', $channel_divmore_height);
+
+		$channel_menu = ((x($_POST['channel_menu'])) ? htmlspecialchars_decode(trim($_POST['channel_menu']),ENT_QUOTES) : '');
+		set_pconfig(local_channel(),'system','channel_menu',$channel_menu);
 		
 		build_sync_packet();
 
@@ -43,12 +46,37 @@ class Channel_home {
 			t('Click to expand content exceeding this height')
 		];
 
+		$menus = menu_list(local_channel());
+		if($menus) {
+			$current = get_pconfig(local_channel(),'system','channel_menu');
+			$menu[] = '';
+			foreach($menus as $m) {
+				$menu[$m['menu_name']] = htmlspecialchars($m['menu_name'],ENT_COMPAT,'UTF-8');
+			}
+
+			$menu_select = [
+				'channel_menu',
+				t('Personal menu to display in your channel pages'),
+				$current,
+				'',
+				$menu
+			];
+		}
+
 		$extra_settings_html = replace_macros(get_markup_template('field_input.tpl'),
 			[
 				'$field' => $channel_divmore_height
 			]
 		);
 
+		if($menu) {
+			$extra_settings_html .= replace_macros(get_markup_template('field_select.tpl'),
+				[
+					'$field' => $menu_select
+				]
+			);
+		}
+
 		$tpl = get_markup_template("settings_module.tpl");
 
 		$o .= replace_macros($tpl, array(
-- 
cgit v1.2.3