diff options
author | Stefan Giehl <stefan@matomo.org> | 2019-09-11 23:38:39 +0300 |
---|---|---|
committer | Thomas Steur <tsteur@users.noreply.github.com> | 2019-09-11 23:38:39 +0300 |
commit | a1dbbfb7eae94378312b18a5cee2cfb0de6f637a (patch) | |
tree | 9cf81aa503b89c4f1a04827ce42b6a9587d36154 | |
parent | 9afda987c0c93c42a6a91e6bc15ee3bb9447426a (diff) |
Show unique visitors metric only if available (#14885)
-rw-r--r-- | plugins/VisitFrequency/Controller.php | 3 | ||||
-rw-r--r-- | plugins/VisitsSummary/Controller.php | 7 |
2 files changed, 9 insertions, 1 deletions
diff --git a/plugins/VisitFrequency/Controller.php b/plugins/VisitFrequency/Controller.php index 48860fe428..479a91da5b 100644 --- a/plugins/VisitFrequency/Controller.php +++ b/plugins/VisitFrequency/Controller.php @@ -12,6 +12,7 @@ use Piwik\Common; use Piwik\FrontController; use Piwik\Piwik; use Piwik\Plugins\CoreVisualizations\Visualizations\Sparklines; +use Piwik\SettingsPiwik; use Piwik\Translation\Translator; use Piwik\View; @@ -69,7 +70,7 @@ class Controller extends \Piwik\Plugin\Controller $period = Common::getRequestVar('period', false); - if ($period == 'day') { + if (SettingsPiwik::isUniqueVisitorsEnabled($period)) { // add number of unique (returning) visitors for period=day $selectableColumns = array_merge( array($selectableColumns[0]), diff --git a/plugins/VisitsSummary/Controller.php b/plugins/VisitsSummary/Controller.php index 91928bd919..51b8087677 100644 --- a/plugins/VisitsSummary/Controller.php +++ b/plugins/VisitsSummary/Controller.php @@ -15,6 +15,7 @@ use Piwik\DataTable\Row; use Piwik\FrontController; use Piwik\Piwik; use Piwik\Plugins\CoreVisualizations\Visualizations\Sparklines; +use Piwik\SettingsPiwik; use Piwik\Site; use Piwik\Translation\Translator; use Piwik\View; @@ -103,6 +104,12 @@ class Controller extends \Piwik\Plugin\Controller 'avg_time_generation' ); + $currentPeriod = Common::getRequestVar('period', false); + + if (!SettingsPiwik::isUniqueVisitorsEnabled($currentPeriod)) { + $selectableColumns = array_diff($selectableColumns, ['nb_uniq_visitors', 'nb_users']); + } + $displaySiteSearch = Site::isSiteSearchEnabledFor($this->idSite); if ($displaySiteSearch) { |