diff --git a/main/inc/ajax/forum.ajax.php b/main/inc/ajax/forum.ajax.php index b8b679cadd..02211887b2 100644 --- a/main/inc/ajax/forum.ajax.php +++ b/main/inc/ajax/forum.ajax.php @@ -110,13 +110,18 @@ if (!empty($action)) { // The only exception is the course manager // They are several pieces for clarity. if (!api_is_allowed_to_edit(null, true) AND - (($current_forum_category && $current_forum_category['visibility'] == 0) OR $current_forum['visibility'] == 0) + ( + ($current_forum_category && $current_forum_category['visibility'] == 0) OR + $current_forum['visibility'] == 0) ) { $json['errorMessage'] = '1. the forum category, forum or thread is invisible (visibility==0)'; break; } if (!api_is_allowed_to_edit(null, true) AND - (($current_forum_category && $current_forum_category['locked'] <> 0) OR $current_forum['locked'] <> 0 OR $current_thread['locked'] <> 0) + ( + ($current_forum_category && $current_forum_category['locked'] <> 0) OR + $current_forum['locked'] <> 0 OR $current_thread['locked'] <> 0 + ) ) { $json['errorMessage'] = '2. the forum category, forum or thread is locked (locked <>0)'; break; @@ -128,7 +133,7 @@ if (!empty($action)) { $group_id = api_get_group_id(); if (!api_is_allowed_to_edit(null, true) AND $current_forum['allow_edit'] == 0 && - !GroupManager::is_tutor_of_group(api_get_user_id(), $group_id) + ($group_id && !GroupManager::is_tutor_of_group(api_get_user_id(), $group_id)) ) { $json['errorMessage'] = '4. if editing of replies is not allowed'; break;