Commit ceada519 by Scott

Hide RSS feeds if empty

parent fb64ec5a
......@@ -129,7 +129,7 @@ if (strlen(qa_get('q'))) {
$qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $start + $gotcount,
qa_opt('pages_prev_next'), array('q' => $inquery), $gotcount >= $count);
if (qa_opt('feed_for_search')) {
if (qa_opt('feed_for_search') && count($results) > 0) {
$qa_content['feed'] = array(
'url' => qa_path_html(qa_feed_request('search/' . $inquery)),
'label' => qa_lang_html_sub('main/results_for_x', qa_html($inquery)),
......
......@@ -89,7 +89,7 @@ $qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize,
if (empty($qa_content['page_links']))
$qa_content['suggest_next'] = qa_html_suggest_qs_tags(true);
if (qa_opt('feed_for_tag_qs')) {
if (qa_opt('feed_for_tag_qs') && count($questions) > 0) {
$qa_content['feed'] = array(
'url' => qa_path_html(qa_feed_request('tag/' . $tag)),
'label' => qa_lang_html_sub('main/questions_tagged_x', qa_html($tag)),
......
......@@ -286,6 +286,11 @@ require_once QA_INCLUDE_DIR . 'util/string.php';
if ($feedtype != 'search' && $feedtype != 'hot') // leave search results and hot questions sorted by relevance
$questions = qa_any_sort_and_dedupe($questions);
// If there are no questions, raise a 404 error but show the feed so users can still subscribe if wanted
if (count($questions) === 0) {
qa_404();
}
$questions = array_slice($questions, 0, $count);
$blockwordspreg = qa_get_block_words_preg();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment