angelorocha

Elgg Roles

Feb 22nd, 2016
42
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. elgg_register_event_handler( 'init', 'system', 'tjce_theme_init' );
  3. function tjce_theme_init() {
  4.     elgg_register_event_handler( 'pagesetup', 'system', 'tjce_theme_pagesetup', 1000 );
  5.     elgg_extend_view( 'css/elgg', 'tjce/css' );
  6.     elgg_register_css( 'bootstrapcss', 'mod/tjce/vendor/css/bootstrap.min.css' );
  7.     elgg_register_css( 'bootstrapbtn', 'mod/tjce/vendor/css/buttons.css' );
  8.     elgg_register_css( 'bootstrapnav', 'mod/tjce/vendor/css/navmenu-custom.css' );
  9.     //elgg_register_css( 'fontawesome', 'mod/tjce/vendor/css/font-awesome.min.css' );
  10.     elgg_register_css( 'login', 'mod/tjce/vendor/css/login.css' );
  11.     elgg_register_css( 'style', 'mod/tjce/vendor/css/style.css' );
  12.     elgg_load_css( 'bootstrapcss' );
  13.     elgg_load_css( 'bootstrapbtn' );
  14.     elgg_load_css( 'bootstrapnav' );
  15.     //elgg_load_css( 'fontawesome' );
  16.     elgg_load_css( 'style' );
  17.  
  18.     if ( ! elgg_is_logged_in() ) {
  19.         elgg_load_css( 'login' );
  20.     }
  21.  
  22.     elgg_register_plugin_hook_handler( 'head', 'page', 'tjce_theme_setup_head' );
  23.  
  24.     elgg_register_js( 'jquery', 'mod/tjce/vendor/js/jquery-1.11.2.min.js' );
  25.     elgg_register_js( 'bootstrapjs', 'mod/tjce/vendor/js/bootstrap.min.js' );
  26.     elgg_load_js( 'bootstrapjs' );
  27.  
  28.     elgg_unextend_view( 'page/elements/header', 'search/header' );
  29.     elgg_extend_view( 'navigation/menu/search', 'search/header' );
  30.  
  31.     /* Init custom Roles */
  32.     elgg_register_plugin_hook_handler( "roles:config", "role", "change_roles_config", 1000 );
  33. }
  34.  
  35. /* Custom Roles */
  36. function change_roles_config( $hook_name, $entity_type, $return_value, $params ) {
  37.     $roles = array(
  38.         DEFAULT_ROLE => array(
  39.             'title'       => 'roles:role:DEFAULT_ROLE',
  40.             'permissions' => array(
  41.                 'pages' => array(
  42.                     'blog/all'                   => array( 'rule' => 'deny', 'forward' => 'dashboard' ),
  43.                     'blog/add'                   => array( 'rule' => 'deny', 'forward' => 'dashboard' ),
  44.                     'blog/add/{$self_guid}'      => array( 'rule' => 'deny', 'forward' => 'dashboard' ),
  45.                     'bookmarks/all'              => array( 'rule' => 'deny', 'forward' => 'dashboard' ),
  46.                     'bookmarks/add'              => array( 'rule' => 'deny', 'forward' => 'dashboard' ),
  47.                     'bookmarks/add/{$self_guid}' => array( 'rule' => 'deny', 'forward' => 'dashboard' ),
  48.                     'file/all'                   => array( 'rule' => 'deny', 'forward' => 'dashboard' ),
  49.                     'file/add'                   => array( 'rule' => 'deny', 'forward' => 'dashboard' ),
  50.                     'file/add/{$self_guid}'      => array( 'rule' => 'deny', 'forward' => 'dashboard' ),
  51.                     'pages/all'                  => array( 'rule' => 'deny', 'forward' => 'dashboard' ),
  52.                     'pages/add'                  => array( 'rule' => 'deny', 'forward' => 'dashboard' ),
  53.                     'pages/add/{$self_guid}'     => array( 'rule' => 'deny', 'forward' => 'dashboard' ),
  54.                 ),
  55.             ),
  56.         ),
  57.     );
  58.     if ( ! is_array( $return_value ) ) {
  59.         return $roles;
  60.     } else {
  61.         return array_merge( $return_value, $roles );
  62.     }
  63. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×