diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php index 704ec6badba..8249e9c36d4 100644 --- a/phpBB/phpbb/content_visibility.php +++ b/phpBB/phpbb/content_visibility.php @@ -144,7 +144,13 @@ public function get_count($mode, $data, $forum_id) */ public function is_visible($mode, $forum_id, $data) { - $is_visible = $this->auth->acl_get('m_approve', $forum_id) || $data[$mode . '_visibility'] == ITEM_APPROVED; + $visibility = $data[$mode . '_visibility']; + $poster_key = ($mode === 'topic') ? 'topic_poster' : 'poster_id'; + $is_visible = $this->auth->acl_get('m_approve', $forum_id) || $visibility == ITEM_APPROVED; + $is_visible = $is_visible || ( + ($visibility == ITEM_UNAPPROVED || $visibility == ITEM_REAPPROVE) + && $this->user->data['user_id'] === $data[$poster_key] + ); /** * Allow changing the result of calling is_visible @@ -216,7 +222,13 @@ public function get_visibility_sql($mode, $forum_id, $table_alias = '') } else { - $where_sql .= $table_alias . $mode . '_visibility = ' . ITEM_APPROVED; + $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']) . ')'; } return '(' . $where_sql . ')'; diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index b2d317764d9..ee4bb088c70 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -294,6 +294,7 @@