Fixes profile menu links (#143)
Jeremy D

Jeremy D commited on 2021-08-18 11:51:31
Showing 4 changed files, with 30 additions and 2 deletions.


Fixes #139
... ...
@@ -56,7 +56,7 @@
56 56
 }
57 57
 
58 58
 /* Main Menu */
59
-#main_menu .main_icons.helpdesk::before {
59
+#main_menu .main_icons.helpdesk::before, .profile_user_links .main_icons.hd_profile::before{
60 60
 	background: url(../images/simpledesk/icons/shd_generic_icons.png) no-repeat;
61 61
 	background-position: -65px -116px;
62 62
 }
... ...
@@ -54,6 +54,7 @@
54 54
 		<hook hook="integrate_error_types" function="shd_error_types" file="$sourcedir/sd_source/Subs-SimpleDesk.php" />
55 55
 		<hook hook="integrate_bbc_codes" function="shd_bbc_codes" file="$sourcedir/sd_source/Subs-SimpleDesk.php" />
56 56
 		<hook hook="integrate_post_parsebbc" function="shd_parse_wikilinks" file="$sourcedir/sd_source/Subs-SimpleDesk.php" />
57
+		<hook hook="integrate_profile_popup" function="shd_profile_menu" file="$sourcedir/sd_source/Subs-SimpleDesk.php" />
57 58
 
58 59
 			<!-- Admin Section: Core -->
59 60
 		<hook hook="integrate_admin_include" function="$sourcedir/sd_source/Subs-SimpleDeskAdmin.php" />
... ...
@@ -116,6 +117,7 @@
116 117
 		<hook reverse="true" hook="integrate_error_types" function="shd_error_types" file="$sourcedir/sd_source/Subs-SimpleDesk.php" />
117 118
 		<hook reverse="true" hook="integrate_bbc_codes" function="shd_bbc_codes" file="$sourcedir/sd_source/Subs-SimpleDesk.php" />
118 119
 		<hook reverse="true" hook="integrate_post_parsebbc" function="shd_parse_wikilinks" file="$sourcedir/sd_source/Subs-SimpleDesk.php" />
120
+		<hook reverse="true" hook="integrate_profile_popup" function="shd_profile_menu" file="$sourcedir/sd_source/Subs-SimpleDesk.php" />
119 121
 
120 122
 			<!-- Admin Section: Core -->
121 123
 		<hook reverse="true" hook="integrate_admin_include" function="$sourcedir/sd_source/Subs-SimpleDeskAdmin.php" />
... ...
@@ -153,6 +153,8 @@ $txt['shd_theme_note'] = 'Normally the helpdesk will inherit the theme a user ha
153 153
 $txt['shd_theme_use_default'] = 'Use the forum default theme';
154 154
 $txt['shd_hidemenuitem'] = 'Hide the Helpdesk menu item?';
155 155
 $txt['shd_hidemenuitem_note'] = 'This is most useful if helpdesk departments are presented on the board index.';
156
+$txt['shd_hidemenuitem'] = 'Hide the Helpdesk Profile menu item?';
157
+$txt['shd_hidemenuitem_note'] = 'If you are using the user menu, this is useful to hide.';
156 158
 $txt['shd_disable_unread'] = 'Disable integration with Unread Posts/Unread Replies';
157 159
 $txt['shd_disable_unread_note'] = 'Normally, SimpleDesk adds a list of topics to the unread posts/unread replies page but sometimes (e.g. certain mobile themes) this does not always work so well.';
158 160
 $txt['shd_zerofill'] = 'Smallest number of digits to use';
... ...
@@ -1837,7 +1837,7 @@ function shd_main_menu(&$menu_buttons)
1837 1837
 		);
1838 1838
 	}
1839 1839
 
1840
-	if (shd_allowed_to(array('shd_view_profile_own', 'shd_view_profile_any'), 0))
1840
+	if (shd_allowed_to(array('shd_view_profile_own', 'shd_view_profile_any'), 0) && empty($modSettings['shd_hideprofilemenuitem']))
1841 1841
 	{
1842 1842
 		// Hmm, this could be tricky. It's possible the main menu has been eaten by permissions at this point, so just in case, reconstruct what's missing.
1843 1843
 		if (empty($menu_buttons['profile']))
... ...
@@ -2019,6 +2019,30 @@ function shd_main_menu_admin($helpdesk_admin)
2019 2019
 }
2020 2020
 // Cause IE is being mean to meeee again...!
2021 2021
 
2022
+/**
2023
+ *	Add the SimpleDesk options to the profile popup menu.
2024
+ *
2025
+ *	@param array &$menu_buttons The main menu buttons as provided by Subs.php.
2026
+ *	@since 2.1
2027
+*/
2028
+function shd_profile_menu(&$profile_items)
2029
+{
2030
+	global $modSettings, $txt, $scripturl;
2031
+
2032
+	if (empty($modSettings['helpdesk_active']))
2033
+		return;
2034
+
2035
+	if (!shd_allowed_to(array('shd_view_profile_own', 'shd_view_profile_any'), 0) || !empty($modSettings['shd_hidemenuitem']))
2036
+		return;
2037
+
2038
+	$profile_items[] = array(
2039
+		'menu' => 'helpdesk',
2040
+		'area' => 'hd_profile',		
2041
+		'title' => $txt['shd_helpdesk_profile'],
2042
+		'url' => $scripturl . '?action=profile;area=hd_profile',
2043
+	);
2044
+}
2045
+
2022 2046
 /**
2023 2047
  *	Detect a SHD error and move it to the proper error type.
2024 2048
  *
2025 2049