Skip to content

Commit 352ea54

Browse files
committed
feat(wizard): show rss menu entry only if rss is avaiable
1 parent e6ed5e7 commit 352ea54

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

inc/common.class.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,8 @@ public static function hookPostShowTab(array $options) {
747747
}
748748

749749
public static function hookRedefineMenu($menus) {
750+
global $DB;
751+
750752
if (Session::getCurrentInterface() != 'helpdesk') {
751753
return $menus;
752754
}
@@ -775,7 +777,19 @@ public static function hookRedefineMenu($menus) {
775777
$newMenu['reservation'] = $menus['reservation'];
776778
}
777779
}
778-
if (RSSFeed::canView()) {
780+
$rssFeedTable = RSSFeed::getTable();
781+
$criteria = [
782+
'SELECT' => "$rssFeedTable.*",
783+
'DISTINCT' => true,
784+
'FROM' => $rssFeedTable,
785+
'ORDER' => "$rssFeedTable.name"
786+
];
787+
$criteria = $criteria + RSSFeed::getVisibilityCriteria();
788+
$criteria['WHERE']["$rssFeedTable.users_id"] = ['<>', Session::getLoginUserID()];
789+
$iterator = $DB->request($criteria);
790+
$hasRssFeeds = $iterator->count() > 0;
791+
792+
if (RSSFeed::canView() && $hasRssFeeds) {
779793
$newMenu['feeds'] = [
780794
'default' => Plugin::getWebDir('formcreator', false) . '/front/wizardfeeds.php',
781795
'title' => __('Consult feeds', 'formcreator'),

0 commit comments

Comments
 (0)