groups.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Elgg notifications plugin group index
  4. *
  5. * @package ElggNotifications
  6. *
  7. * @uses $user ElggUser
  8. */
  9. if (!isset($user) || !($user instanceof ElggUser)) {
  10. $url = 'notifications/group/' . elgg_get_logged_in_user_entity()->username;
  11. forward($url);
  12. }
  13. elgg_set_page_owner_guid($user->guid);
  14. // Set the context to settings
  15. elgg_set_context('settings');
  16. $title = elgg_echo('notifications:subscriptions:changesettings:groups');
  17. elgg_push_breadcrumb(elgg_echo('settings'), "settings/user/$user->username");
  18. elgg_push_breadcrumb($title);
  19. $dbprefix = elgg_get_config('dbprefix');
  20. $groupmemberships = elgg_get_entities_from_relationship(array(
  21. 'relationship' => 'member',
  22. 'relationship_guid' => $user->guid,
  23. 'type' => 'group',
  24. 'joins' => array("JOIN {$dbprefix}groups_entity ge ON e.guid = ge.guid"),
  25. 'order_by' => 'ge.name ASC',
  26. 'limit' => false,
  27. ));
  28. $body = elgg_view_form('notificationsettings/groupsave', array(), array(
  29. 'groups' => $groupmemberships,
  30. 'user' => $user,
  31. ));
  32. $params = array(
  33. 'content' => $body,
  34. 'title' => $title,
  35. );
  36. $body = elgg_view_layout('one_sidebar', $params);
  37. echo elgg_view_page($title, $body);