Browse Source

Don't throw an error when unlinked events are allowed and you can't actually post in any boards (fixes #1182 again)

Signed-off-by: Michael Eshom <[email protected]>
Michael Eshom 10 years ago
parent
commit
1889f8bcc5
2 changed files with 17 additions and 12 deletions
  1. 16 11
      Sources/Calendar.php
  2. 1 1
      Themes/default/Calendar.template.php

+ 16 - 11
Sources/Calendar.php

@@ -331,17 +331,22 @@ function CalendarPost()
 		// Get list of boards that can be posted in.
 		$boards = boardsAllowedTo('post_new');
 		if (empty($boards))
-			fatal_lang_error('cannot_post_new', 'permission');
-
-		// Load the list of boards and categories in the context.
-		require_once($sourcedir . '/Subs-MessageIndex.php');
-		$boardListOptions = array(
-			'included_boards' => in_array(0, $boards) ? null : $boards,
-			'not_redirection' => true,
-			'use_permissions' => true,
-			'selected_board' => $modSettings['cal_defaultboard'],
-		);
-		$context['event']['categories'] = getBoardList($boardListOptions);
+		{
+			// You can post new events but can't link them to anything...
+			$context['event']['categories'] = array();
+		}
+		else
+		{
+			// Load the list of boards and categories in the context.
+			require_once($sourcedir . '/Subs-MessageIndex.php');
+			$boardListOptions = array(
+				'included_boards' => in_array(0, $boards) ? null : $boards,
+				'not_redirection' => true,
+				'use_permissions' => true,
+				'selected_board' => $modSettings['cal_defaultboard'],
+			);
+			$context['event']['categories'] = getBoardList($boardListOptions);
+		}
 	}
 	else
 	{

+ 1 - 1
Themes/default/Calendar.template.php

@@ -615,7 +615,7 @@ function template_event_post()
 	}
 
 	// If this is a new event let the user specify which board they want the linked post to be put into.
-	if ($context['event']['new'])
+	if ($context['event']['new'] && !empty($context['event']['categories']))
 	{
 		echo '
 							<li>