Browse Source

Hide attachments permissions if attachments are disabled - thanks Illori for the report

Signed-off-by: emanuele <[email protected]>
emanuele 12 years ago
parent
commit
63669b33df
1 changed files with 9 additions and 0 deletions
  1. 9 0
      Sources/ManagePermissions.php

+ 9 - 0
Sources/ManagePermissions.php

@@ -1570,6 +1570,15 @@ function loadAllPermissions($loadType = 'classic')
 		$relabelPermissions['post_attachment'] = 'auto_approve_attachments';
 	}
 
+	// Are attachments enabled?
+	if (empty($modSettings['attachmentEnable']))
+	{
+		$hiddenPermissions[] = 'manage_attachments';
+		$hiddenPermissions[] = 'view_attachments';
+		$hiddenPermissions[] = 'post_unapproved_attachments';
+		$hiddenPermissions[] = 'post_attachment';
+	}
+
 	// Provide a practical way to modify permissions.
 	call_integration_hook('integrate_load_permissions', array(&$permissionGroups, &$permissionList, &$leftPermissionGroups, &$hiddenPermissions, &$relabelPermissions));