notification_tools.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * UI for forcing notification methods for all site users
  4. */
  5. elgg_require_js('notification_tools/process');
  6. $dbprefix = elgg_get_config('dbprefix');
  7. $user_count = elgg_get_entities(array(
  8. 'type' => 'user',
  9. 'count' => true,
  10. ));
  11. /**
  12. * Personal notifications
  13. */
  14. echo elgg_view('admin/administer_utilities/enable_setting', array(
  15. 'setting' => 'personal',
  16. 'count' => $user_count,
  17. ));
  18. /**
  19. * Friend collection notifications
  20. */
  21. echo elgg_view('admin/administer_utilities/enable_setting', array(
  22. 'setting' => 'collection',
  23. 'count' => $user_count,
  24. ));
  25. /**
  26. * Get count of group memberships
  27. */
  28. $membership_count = get_data(
  29. "SELECT COUNT(id) AS count
  30. FROM {$dbprefix}entity_relationships r
  31. INNER JOIN {$dbprefix}entities ue ON ue.guid = r.guid_one
  32. INNER JOIN {$dbprefix}entities ge ON ge.guid = r.guid_two
  33. WHERE r.relationship = 'member'
  34. AND ue.type = 'user'
  35. AND ge.type = 'group'
  36. "
  37. );
  38. if ($membership_count) {
  39. echo elgg_view('admin/administer_utilities/enable_setting', array(
  40. 'setting' => 'group',
  41. 'count' => $membership_count[0]->count,
  42. ));
  43. }