Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@gmail.com>2015-01-26 07:05:11 +0300
committerThomas Steur <thomas.steur@gmail.com>2015-02-10 06:52:05 +0300
commit0d95d2b9f2d6b0440ab2803930e7f68c4816f37d (patch)
tree10a99a9a10e78e24e6155324bd2437061891222d /plugins/VisitsSummary
parent175421ec6477f8df9f336841c054a11dde166c0f (diff)
refs #6705 one way to detect whether user feature is enabled for a given site. looking for other solutions as well
Diffstat (limited to 'plugins/VisitsSummary')
-rw-r--r--plugins/VisitsSummary/Reports/Get.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/plugins/VisitsSummary/Reports/Get.php b/plugins/VisitsSummary/Reports/Get.php
index f2a087a517..9df37d9bf5 100644
--- a/plugins/VisitsSummary/Reports/Get.php
+++ b/plugins/VisitsSummary/Reports/Get.php
@@ -12,6 +12,7 @@ use Piwik\Piwik;
use Piwik\Plugins\CoreHome\Columns\Metrics\ActionsPerVisit;
use Piwik\Plugins\CoreHome\Columns\Metrics\AverageTimeOnSite;
use Piwik\Plugins\CoreHome\Columns\Metrics\BounceRate;
+use Piwik\Plugins\CoreHome\Columns\UserId;
class Get extends \Piwik\Plugin\Report
{
@@ -39,6 +40,28 @@ class Get extends \Piwik\Plugin\Report
$this->order = 1;
}
+ public function configureReportMetadata(&$availableReports, $infos)
+ {
+ if (!$this->isEnabled()) {
+ return;
+ }
+
+ if (!empty($infos['idSites']) && !empty($infos['period']) && !empty($infos['date'])) {
+ $userId = new UserId();
+ $isUserIdUsed = $userId->isUsedInAtLeastOneSite($infos['idSites'], $infos['period'], $infos['date']);
+
+ if (!$isUserIdUsed) {
+ $key = array_search('nb_users', $this->metrics);
+ if (false !== $key) {
+ unset($this->metrics[$key]);
+ $this->metrics = array_values($this->metrics);
+ }
+ };
+ }
+
+ parent::configureReportMetadata($availableReports, $infos);
+ }
+
public function getMetrics()
{
$metrics = parent::getMetrics();