diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 05871e4157..2441a37edc 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -101,6 +101,7 @@ class acp_board 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_birthdays' => array('lang' => 'ALLOW_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'display_last_subject' => array('lang' => 'DISPLAY_LAST_SUBJECT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'display_unapproved_posts' => array('lang' => 'DISPLAY_UNAPPROVED_POSTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'custom', 'method' => 'quick_reply', 'explain' => true), 'legend2' => 'ACP_SUBMIT_CHANGES', diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index fdc02d9ae8..5fa170bdb5 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -52,6 +52,8 @@ $lang = array_merge($lang, array( 'DISABLE_BOARD_EXPLAIN' => 'This will make the board unavailable to users who are neither administrators nor moderators. You can also enter a short (255 character) message to display if you wish.', 'DISPLAY_LAST_SUBJECT' => 'Display subject of last added post on forum list', 'DISPLAY_LAST_SUBJECT_EXPLAIN' => 'The subject of the last added post will be displayed in the forum list with a hyperlink to the post. Subjects from password protected forums and forums in which user doesn’t have read access are not shown.', + 'DISPLAY_UNAPPROVED_POSTS' => 'Display unapproved posts to the poster', + 'DISPLAY_UNAPPROVED_POSTS_EXPLAIN' => 'The poster will be able to see his unapproved posts while they are in the moderation queue. This does not restrict the visbility to Moderators', 'GUEST_STYLE' => 'Guest style', 'GUEST_STYLE_EXPLAIN' => 'The board style for guests.', 'OVERRIDE_STYLE' => 'Override user style', diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php index 8249e9c36d..699bfa167e 100644 --- a/phpBB/phpbb/content_visibility.php +++ b/phpBB/phpbb/content_visibility.php @@ -222,15 +222,16 @@ class content_visibility } else { - $field_name = ($mode === 'topic') ? 'topic_poster' : 'poster_id'; $visibility_query = $table_alias . $mode . '_visibility = '; $where_sql .= '(' . $visibility_query . ITEM_APPROVED . ')'; - $where_sql .= ' OR ('; - $where_sql .= '(' . $visibility_query . ITEM_UNAPPROVED . ' OR ' . $visibility_query . ITEM_REAPPROVE . ')'; - $where_sql .= ' AND ' . $table_alias . $field_name . ' = ' . ((int) $this->user->data['user_id']) . ')'; + if ($this->config['display_unapproved_posts'] && ($this->user->data['user_id'] <> ANONYMOUS)) + { + $poster_key = ($mode === 'topic') ? 'topic_poster' : 'poster_id'; + $where_sql .= ' OR (' . $visibility_query . ITEM_UNAPPROVED; + $where_sql .= ' AND ' . $table_alias . $poster_key . ' = ' . ((int) $this->user->data['user_id']) . ')'; + } } - return '(' . $where_sql . ')'; } diff --git a/phpBB/phpbb/db/migration/data/v330/add_display_unapproved_posts_config.php b/phpBB/phpbb/db/migration/data/v330/add_display_unapproved_posts_config.php new file mode 100644 index 0000000000..e3d2bddb0b --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v330/add_display_unapproved_posts_config.php @@ -0,0 +1,24 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v330; + +class add_display_unapproved_posts_config extends \phpbb\db\migration\migration +{ + public function update_data() + { + return array( + array('config.add', array('display_unapproved_posts', 1)), + ); + } +} diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 4691512cbd..f6107b7c3b 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -899,6 +899,11 @@ if (count($topic_list)) // Replies $replies = $phpbb_content_visibility->get_count('topic_posts', $row, $topic_forum_id) - 1; + //correct for case of unapproved topic visible to poster - a bit dirty but efficient + if ($replies < 0) + { + $replies++; + } if ($row['topic_status'] == ITEM_MOVED) {