Permalink
Browse files

feature(routing): Render notification pages with views

  • Loading branch information...
ewinslow committed May 28, 2015
1 parent 91b5280 commit dcfb17617c87febab9e92433230f085beaa94026
@@ -51,20 +51,15 @@ function notifications_page_handler($page) {
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';
+ set_input('username', $page[1]);
// note: $user passed in
switch ($page[0]) {
case 'group':
- require "$base/groups.php";
+ echo elgg_view('resources/notifications/groups');
break;
case 'personal':
- require "$base/index.php";
+ echo elgg_view('resources/notifications/index');
break;
default:
return false;
@@ -6,6 +6,14 @@
*
* @uses $user ElggUser
*/
+$current_user = elgg_get_logged_in_user_entity();
+
+$username = get_input('username');
+$user = get_user_by_username($username);
+if (($user->guid != $current_user->guid) && !$current_user->isAdmin()) {
+ forward();
+}
+
if (!isset($user) || !($user instanceof ElggUser)) {
$url = 'notifications/group/' . elgg_get_logged_in_user_entity()->username;
@@ -7,6 +7,13 @@
* @uses $user ElggUser
*/
+$current_user = elgg_get_logged_in_user_entity();
+$username = get_input('username');
+$user = get_user_by_username($username);
+if (($user->guid != $current_user->guid) && !$current_user->isAdmin()) {
+ forward();
+}
+
if (!isset($user) || !($user instanceof ElggUser)) {
$url = 'notifications/personal/' . elgg_get_logged_in_user_entity()->username;
forward($url);

0 comments on commit dcfb176

Please sign in to comment.