Advertisement
Guest User

Social Code

a guest
May 17th, 2012
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.25 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  *
  5.  * Moderators for Roles plugin
  6.  *
  7.  *
  8.  * @author Andras Szepeshazi
  9.  * @copyright Arck Interactive, LLC 2012
  10.  * @link http://www.arckinteractive.com/
  11.  */
  12.  
  13. elgg_register_event_handler('init', 'system', 'students_init');
  14.  
  15. function students_init() {
  16.  
  17.     elgg_register_plugin_hook_handler('roles:config', 'role', 'students_config', 700);
  18. }
  19.  
  20.  
  21. function students_config($hook_name, $entity_type, $return_value, $params) {
  22.  
  23.     $roles = array(
  24.  
  25. 'student' => array(
  26.     'title' => 'students:role:title',
  27.             'extends' => array(),
  28.             'permissions' => array(
  29.                 'actions' => array(
  30.                     'groups/edit' => array('rule' => 'deny'),
  31.                     'groups/leave' => array('rule' => 'deny'),
  32.  
  33.                 ),
  34.                
  35.                 'pages' => array(
  36.                     'groups/add/{$self_guid}' => array('rule' => 'deny'),
  37.                     'blog/add/{$self_guid}' => array('rule' => 'deny'),
  38.                     'regexp(/^admin\/$/)' => array('rule' => 'deny'),
  39.                 ),
  40.                 'menus' => array(
  41.                 'topbar::administration' => array('rule' => 'deny'),
  42.                
  43.                     'title::add' => array(
  44.                         'rule' => 'deny',
  45.                         'context' => array('groups')
  46.                     ),
  47.                    
  48.    
  49.                 ),
  50.                
  51.             ),
  52.         ),
  53.    
  54.        
  55.     );
  56.  
  57.     if (!is_array($return_value)) {
  58.         return $roles;
  59.     } else {
  60.         return array_merge($return_value, $roles);
  61.     }
  62. }
  63.  
  64. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement