Skip to content

Commit

Permalink
feat(wizard): show rss menu entry only if rss is avaiable
Browse files Browse the repository at this point in the history
  • Loading branch information
btry committed Apr 11, 2022
1 parent e6ed5e7 commit 352ea54
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion inc/common.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,8 @@ public static function hookPostShowTab(array $options) {
}

public static function hookRedefineMenu($menus) {
global $DB;

if (Session::getCurrentInterface() != 'helpdesk') {
return $menus;
}
Expand Down Expand Up @@ -775,7 +777,19 @@ public static function hookRedefineMenu($menus) {
$newMenu['reservation'] = $menus['reservation'];
}
}
if (RSSFeed::canView()) {
$rssFeedTable = RSSFeed::getTable();
$criteria = [
'SELECT' => "$rssFeedTable.*",
'DISTINCT' => true,
'FROM' => $rssFeedTable,
'ORDER' => "$rssFeedTable.name"
];
$criteria = $criteria + RSSFeed::getVisibilityCriteria();
$criteria['WHERE']["$rssFeedTable.users_id"] = ['<>', Session::getLoginUserID()];
$iterator = $DB->request($criteria);
$hasRssFeeds = $iterator->count() > 0;

if (RSSFeed::canView() && $hasRssFeeds) {
$newMenu['feeds'] = [
'default' => Plugin::getWebDir('formcreator', false) . '/front/wizardfeeds.php',
'title' => __('Consult feeds', 'formcreator'),
Expand Down

0 comments on commit 352ea54

Please sign in to comment.