Skip to content

Instantly share code, notes, and snippets.

Created May 16, 2012 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2713919 to your computer and use it in GitHub Desktop.
Save anonymous/2713919 to your computer and use it in GitHub Desktop.
<?php
/**
*
*Students for Roles plugin
*
*
* @author Andras Szepeshazi
* @copyright Arck Interactive, LLC 2012
* @link http://www.arckinteractive.com/
*/
elgg_register_event_handler('init', 'system', 'students_init');
function students_init() {
elgg_register_plugin_hook_handler('roles:config', 'role', 'students_config', 700);
}
function students_config($hook_name, $entity_type, $return_value, $params) {
$roles = array(
'student' => array(
'title' => 'students:role:title',
'extends' => array(),
'permissions' => array(
'actions' => array(
'groups/leave' => array('rule' => 'deny'),
),
'pages' => array(
'groups/add/{$self_guid}' => array('rule' => 'deny'),
),
'pages' => array(
'blog/add/{$self_guid}' => array('rule' => 'deny'),
),
'menus' => array(
'title::add' => array(
'rule' => 'deny',
'context' => array('groups')
),
),
),
),
);
if (!is_array($return_value)) {
return $roles;
} else {
return array_merge($return_value, $roles);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment