Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,11 @@ public function editNotification($id = null)
{
Piwik::checkUserHasSuperUserAccess();
if (!isset($id)) {
$notificationId = trim(Request::fromRequest()->getStringParameter('notificationId', 'string'));
} else {
$notificationId = $id;
$id = trim(Request::fromRequest()->getStringParameter('id', 'string'));
}

$db = Db::get();
$notification = $db->fetchRow("SELECT * FROM `" . Common::prefixTable('rebel_notifications') . "` WHERE id = ?", [$notificationId]);
$notification = $db->fetchRow("SELECT * FROM `" . Common::prefixTable('rebel_notifications') . "` WHERE id = ?", [$id]);
if (empty($notification)) {
throw new \Exception('Notification not found');
}
Expand Down
2 changes: 1 addition & 1 deletion Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function configureAdminMenu(MenuAdmin $menu)
);
$menu->addItem(
'RebelNotifications_RebelNotifications',
'RebelNotifications_RebelNotifications',
'RebelNotifications_Manage',
$this->urlForAction('index'),
$order = 43
);
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ Rebel Notifications are using the built in Notifications in Matomo and adds a UI

This plugin was inspired by the [Admin Notification](https://plugins.matomo.org/AdminNotification) plugin by [Josh Brule](https://github.com/jbrule).

## Installation

Install the plugin as you normally install any Matomo plugin.

## Usage

After installation, a new menu item is visible in the admin part of Matomo - "Rebel Notifications".
At "Manage" you can add, edit and delete notifications.

When you add or change a notification, nothing is changed until you logout and login. The triggering event for the notifications is `Login.authenticate.successful` - which means that nothing updates until you login.

## Using RebelNotifications with Matomo API

Examples with curl.
Expand Down
6 changes: 6 additions & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"RebelNotifications": {
"RebelNotifications": "Rebel Notifications",
"Manage": "Manage"
}
}
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "RebelNotifications",
"description": "Show Notifications to your users.",
"version": "5.0.1",
"version": "5.0.2",
"theme": false,
"require": {
"matomo": ">=5.0.0-stable,<6.0.0-b1"
Expand Down
2 changes: 1 addition & 1 deletion templates/editNotification.twig
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<div class="row">
<label>
Message:
<textarea name="message" required>{{ notification.message }}</textarea>
<textarea name="message" class="materialize-textarea" required>{{ notification.message }}</textarea>
</label>
</div>
<div class="row">
Expand Down
2 changes: 1 addition & 1 deletion templates/manageNotifications.twig
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<td>{{ notification.type }}</td>
<td>{{ notification.raw }}</td>
<td>
<a href="{{ linkTo({'module':'RebelNotifications','action':'editNotification', 'notificationId': notification.id}) }}">
<a href="{{ linkTo({'module':'RebelNotifications','action':'editNotification', 'id': notification.id}) }}">
<span class="icon-edit"></span>
</a>
</td>
Expand Down