hooks.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /*hooks for au group activity */
  3. /**
  4. * Provide group owner_block link to activity page
  5. */
  6. function aga_owner_block($hook, $type, $return, $params) {
  7. $group=$params['entity'];
  8. if (elgg_instanceof($group, 'group')) {
  9. //kill the activity menu
  10. foreach($return as $key=>$item){
  11. if($item->getName()=='activity'){
  12. unset($return[$key]);
  13. }
  14. }
  15. //add the menu item if activity is enabled
  16. if ($group->activity_enable != 'no'){
  17. $url = 'group_activity_plus/group/' . $params['entity']->guid . '/ingroup';
  18. $item = new ElggMenuItem('aga', elgg_echo('groups:activity'), $url);
  19. $return[] = $item;
  20. }
  21. }
  22. return $return;
  23. }
  24. // pluginhook to kill all the standard activity tabs called from activity page handler
  25. function aga_kill_activity_tabs($hook,$type,$return,$params){
  26. //get rid of standard activity tabs
  27. foreach($return as $key=>$item){
  28. $tabs=array('all','mine','friend');
  29. if(in_array($item->getName(), $tabs)){
  30. unset($return[$key]);
  31. }
  32. }
  33. return $return;
  34. }