aboutsummaryrefslogtreecommitdiff
path: root/mod/notifications/start.php
diff options
context:
space:
mode:
authorSteve Clay <steve@mrclay.org>2012-06-24 00:09:17 -0400
committerSteve Clay <steve@mrclay.org>2012-06-24 00:09:17 -0400
commit4a3c49240140449ef4c91c4b999a91b11380db3c (patch)
tree3d1e92342473e2fd90059d9abcfe88e79def9a25 /mod/notifications/start.php
parentd71309056037adc869319566f9ec53313eb192d8 (diff)
downloadelgg-4a3c49240140449ef4c91c4b999a91b11380db3c.tar.gz
elgg-4a3c49240140449ef4c91c4b999a91b11380db3c.tar.bz2
Fixes #4138: Admin can edit any users' notifications
Diffstat (limited to 'mod/notifications/start.php')
-rw-r--r--mod/notifications/start.php22
1 files changed, 19 insertions, 3 deletions
diff --git a/mod/notifications/start.php b/mod/notifications/start.php
index 761f17e40..d5d418f0f 100644
--- a/mod/notifications/start.php
+++ b/mod/notifications/start.php
@@ -40,13 +40,25 @@ function notifications_plugin_init() {
*/
function notifications_page_handler($page) {
+ gatekeeper();
+ $current_user = elgg_get_logged_in_user_entity();
+
// default to personal notifications
if (!isset($page[0])) {
$page[0] = 'personal';
}
+ if (!isset($page[1])) {
+ forward("notifications/{$page[0]}/{$current_user->username}");
+ }
+
+ $user = get_user_by_username($page[1]);
+ if (($user->guid != $current_user->guid) && !$current_user->isAdmin()) {
+ forward();
+ }
$base = elgg_get_plugins_path() . 'notifications';
+ // note: $user passed in
switch ($page[0]) {
case 'group':
require "$base/groups.php";
@@ -66,12 +78,16 @@ function notifications_page_handler($page) {
*/
function notifications_plugin_pagesetup() {
if (elgg_get_context() == "settings" && elgg_get_logged_in_user_guid()) {
- $user = elgg_get_logged_in_user_entity();
+
+ $user = elgg_get_page_owner_entity();
+ if (!$user) {
+ $user = elgg_get_logged_in_user_entity();
+ }
$params = array(
'name' => '2_a_user_notify',
'text' => elgg_echo('notifications:subscriptions:changesettings'),
- 'href' => "notifications/personal",
+ 'href' => "notifications/personal/{$user->username}",
);
elgg_register_menu_item('page', $params);
@@ -79,7 +95,7 @@ function notifications_plugin_pagesetup() {
$params = array(
'name' => '2_group_notify',
'text' => elgg_echo('notifications:subscriptions:changesettings:groups'),
- 'href' => "notifications/group",
+ 'href' => "notifications/group/{$user->username}",
);
elgg_register_menu_item('page', $params);
}