From 5b7263da6971898d56930024072ced2d6e004be7 Mon Sep 17 00:00:00 2001 From: Joshua Brule Date: Mon, 11 Sep 2017 15:50:13 -0500 Subject: [PATCH] Confirmed v2 compatibility. Fixed up README. Added v3 logoff/on requirement for v3.x --- AdminNotification.php | 5 +++++ README.md | 22 +++++++++++----------- SystemSettings.php | 5 +---- lang/en.json | 2 +- lang/ja.json | 2 +- plugin.json | 2 +- 6 files changed, 20 insertions(+), 18 deletions(-) diff --git a/AdminNotification.php b/AdminNotification.php index bfe18fe..fe077e6 100644 --- a/AdminNotification.php +++ b/AdminNotification.php @@ -68,6 +68,11 @@ public function settingsChangedV3($settings){ public function setNotificationV3(){ //Known issue. The alert notification is not updated until login/logout on v3.x. + //2.X Compatibility. This method appears to be getting called in v2.X which I didn't believe would trigger the newer hooks. + if(!class_exists('\Piwik\Settings\Plugin\SystemSettings')){ //If class doesn't exist just get out. + return; + } + $settings = new SystemSettings(); //print_r($settings->enabled->getValue()); diff --git a/README.md b/README.md index 7a1d321..1e5885c 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,21 @@ -#Piwik AdminNotification Plugin -##Description +# Piwik AdminNotification Plugin +## Description Adds the ability for Piwik administrators to include an informative message on all users' dashboards. This may be useful for communicating with users in larger shared environments. In our setup we were tracking 1,900 websites with 250 users. This is a solution we wrote to allow us to easily inform our users of maintainance windows. -##Instructions +## Instructions The easiest way to install is to find the plugin in the [Piwik Marketplace](http://plugins.piwik.org/). -##Changelog -3.0.0 Piwik v3 compatible. -0.1.2 Tested with Piwik v2.15 and included new registerEvents() hook for compatibility with Piwik 3.0 -0.1.1 Cleanup. Removed plugin template verbiage from code files. -0.1.0 Initial Release +## Changelog +* 3.0.0 Piwik v3 compatible. Effort was made to maintain backwords compatibility. This should work all the way back to 2.12.x +* 4.0.1.2 Tested with Piwik v2.15 and included new registerEvents() hook for compatibility with Piwik 3.0 +* 5.0.1.1 Cleanup. Removed plugin template verbiage from code files. +* 0.1.0 Initial Release -##Known Issues -v3.0.0 Display/Update of notification required logout/login to see change. (Notification API not working as expected during tests) +## Known Issues +* v3.0.0 Display/Update of notification requires logout/login to see change. (Notification API not working as expected during tests) ##License GPL v3 / fair use ## Support -Please [report any issues](https://github.com/jbrule/piwikplugin-AdminNotification/issues). Pull requests welcome. +Please [report any issues](https://github.com/jbrule/piwikplugin-AdminNotification/issues). Pull requests welcome. \ No newline at end of file diff --git a/SystemSettings.php b/SystemSettings.php index 08a7537..6940f8c 100644 --- a/SystemSettings.php +++ b/SystemSettings.php @@ -33,10 +33,7 @@ class SystemSettings extends \Piwik\Settings\Plugin\SystemSettings public $messageTitle; /** @var Setting */ - public $description; - - /** @var Setting */ - public $password; + public $message; protected function init() { diff --git a/lang/en.json b/lang/en.json index d9324e1..b904251 100644 --- a/lang/en.json +++ b/lang/en.json @@ -2,7 +2,7 @@ "AdminNotification": { "PluginDescription": "Places a message on all user's dashboards.", "EnabledSettingTitle": "Enabled", - "EnabledSettingDescription": " If enabled, the provided message will be displayed to users upon login.", + "EnabledSettingDescription": "If enabled, the provided message will be displayed to users upon login. (Logoff/Logon required in v3.x)", "MessageSettingTitle": "Message", "MessageSettingDescription": "Message to display to users", "ContextSettingTitle": "Context", diff --git a/lang/ja.json b/lang/ja.json index 84af98d..9576334 100644 --- a/lang/ja.json +++ b/lang/ja.json @@ -2,7 +2,7 @@ "AdminNotification": { "PluginDescription": "Places a message on all user's dashboards.", "EnabledSettingTitle": "使用可能", - "EnabledSettingDescription": "If enabled, the provided message will be displayed to users upon login.", + "EnabledSettingDescription": "If enabled, the provided message will be displayed to users upon login. (Logoff/Logon required in v3.x)", "MessageSettingTitle": "メッセージ", "MessageSettingDescription": "Message to display to users", "ContextSettingTitle": "コンテキスト", diff --git a/plugin.json b/plugin.json index 26ddef1..ad1384a 100644 --- a/plugin.json +++ b/plugin.json @@ -10,7 +10,7 @@ "homepage": "https:\/\/github.com\/jbrule\/piwikplugin-AdminNotification", "theme": false, "require": { - "piwik": ">=3.0.4-stable,<4.0.0-b1" + "piwik": ">=2.12.0,<4.0.0-b1" }, "authors": [ {