Release Notes

  • Fixed fatal error raised by gaps in the menu array
  • Fixed issue when only one menu item could be appended, replaced or removed instead of multiple items

  • I have a problem with Default role.

    For simple i have created 3 mod for tre roles:

    - role 1[deafault]

    - role 2[super user]

    - role 3[drafter]

     

     

    The problem occurs with the first part. In fact, the code does not seem to make any changes. I think I err with some object name but the issue is with an example Also in Documentation.

     

    problem:

    - 'blog/add/{$self_guid}' => array('rule' => 'deny'), [does not work but I know already why XD]

    - 'title::add' => array(
    'rule' => 'deny',
    'context' => array('friend')
    ),                                      [this does not work, should hide add friend button in avatar]

    - 'title::edit' => array(
    'rule' => 'deny',
    'context' => array('avatar')
    ),                                     [this does not work, should hide upload button]

    - 'site::files' => array('rule' => 'deny'),  [files remain in elgg menu items. I also tried to write files instead of files but nothing changed.]

     

    and finally, with this code taken from the documentation breaks my site

    -

    'site::groups' => array( // 3rd menu rule
    'rule' => 'replace',
    'menu_item' => array(
    'name' => 'mygroups',
    'text' => 'My Groups',
    'href' => 'groups/member/{$self_username}',
    )
    ),

     

    my complete code is this:

     

     

    elgg_register_event_handler('init', 'system', 'roles_one_init');

    function roles_one_init() {

    elgg_register_plugin_hook_handler('roles:config', 'role', 'roles_one_config', 600);

    //$action_base_path = elgg_get_plugins_path() . 'roles_group_admins/actions/roles_group_admins';
    //elgg_register_action("roles_group_admins/make_group_admin", "$action_base_path/make_group_admin.php");
    //elgg_register_action("roles_group_admins/revoke_group_admin", "$action_base_path/revoke_group_admin.php");
    }


    function roles_one_config($hook_name, $entity_type, $return_value, $params) {

    $roles = array(

    DEFAULT_ROLE => array(
    'title' => 'roles:role:DEFAULT_ROLE',
    'extends' => array(),
    'permissions' => array(
    'actions' => array(
    'groups/edit' => array('rule' => 'deny'),
    'friends/add' => array('rule' => 'deny'),
    'friends/remove' => array('rule' => 'deny'),
    'blog/save' => array('rule' => 'deny'),
    'file/upload' => array('rule' => 'deny'),
    ),
    #visualizzazione pagine
    'pages' => array(
    'groups/add/{$self_guid}' => array('rule' => 'deny'),
    'blog/add/{$self_guid}' => array('rule' => 'deny'),
    'file/add/{$self_guid}' => array('rule' => 'deny'),
    ),
    #visualizzazione bottoni
    'menus' => array(
    'title::add' => array(
    'rule' => 'deny',
    'context' => array('groups')
    ),
    'title::add' => array(
    'rule' => 'deny',
    'context' => array('friend')
    ),
    'title::add' => array(
    'rule' => 'deny',
    'context' => array('blog')
    ),
    'title::add' => array(
    'rule' => 'deny',
    'context' => array('file')
    ),
    'title::edit' => array(
    'rule' => 'deny',
    'context' => array('avatar')
    ),
    'page::groups:owned' => array(
    'rule' => 'deny',
    'context' => array('groups'),
    ),
    'site::members' => array('rule' => 'deny'),
    'site::files' => array('rule' => 'deny'),
    'site::blog' => array('rule' => 'deny'),
    ),
    'views' => array(
    'input/password' => array('rule' => 'deny'),

    ),
    ),
    ));

    if (!is_array($return_value)) {
    return $roles;
    } else {
    return array_merge($return_value, $roles);
    }
    }

    thanks a lot for any help ^^

  • ATTENTION! elgg-novice and other ;-))
    this plugin has an exemplary documentation and the source is well commented
    thx Andras

  • Hi. will a new release of this plugin follow ? if yes when and will the new release be also a framework or will it be a stand- alone plugin, so that people like me, whose programming knowledge is not good also can use these  usefull functions???

  • Hi everyone... I m new to elgg... I want to add a new column in my elgg_users_entity table called "role" with enum values ('super_admin','sub_admin','support_member','site_member') to handle user permissions depending upon roles. If I alter the table will it creates any problem  in the future if I want to upgrade Elgg with some newer version... Anyone tell me how can I handle it and suggest me with the best way please ...

    Thanks in advance...

  • Yes it will cause big problems.

    Learn the Elgg data model first, then you'll understand that you don't need to add anything to the database.

    http://docs.elgg.org/wiki/Dont_Modify_Core

    http://docs.elgg.org/wiki/Should_I_edit_the_database_manually%3F

  • How to 'deny' the 'Mine' tab in 'blog/all' page?

    I've tried with this code :
    'menus' => array(
    'title::add' => array(
    'rule' => 'deny',
    'context' => array('groups', 'blog', 'file') // deny add buttons, successed
    ),
    'title::blog:owned' => array( // I want to deny mine tab, but not successed yet. :(
    'rule' => 'deny',
    'context' => array('blog')
    )
    ),

    So, any idea?

  • Roles is very compatible with any Elgg theme and FB theme too. Just see on our website (there is a deep customisation Elgg core and FB theme)

  • We used this amazing plugin to build a new version with these features : 

    • Roles creation/mod/del (by admin), specifying wich group/s are allowed.
    • Account creation (admin panel) with Role for the member (the new member joins automatically  the group/s specified in the Role)
    • The new member, when login in, is redirected to "my groups" page. He/she can't go anywhere else but the group contents and his/her profile

    So, I can invite a partner, co-worker, customer to a specific group only.

    This plugin will be available on friday with an english translation 

  • @odutel That sounds great, can't wait for it. Thanks.

  • Hi Human. 
    have you made a new plugin or ... ?

  • its the moderator roles add on to this plugin i am sure they mean

  • hi guys,

    I have a simple question.
    I'm trying to set a new role when 2 conditions are met, but for some reason the new role doesn't get set.
    Anyone an idea what I do wrong?

    the condition is good, I get the echo message that the role will be set, but no role gets set, so the problem has to be in: roles_set_role($new_role, $user);

    ----------------

    $user = elgg_extract('entity', $vars, elgg_get_logged_in_user_entity());
    $current_role = roles_get_role($user);
    $current_role_name = $current_role->name;
    $new_role = 'PRO_ROLE';                 
    if
     ($mycondition == 'yes' && $current_role_name == 'default')  {
            echo 'good combination role will be set';
            roles_set_role($new_role, $user);
            }
                
    else {
      echo "nothing happens conditions are not met";
    }
    ----------------

    Thanks

  • Hi

    I have a question, with this plugin can I define two user types that for example one type of user can see blog post but and they can not add blog post, and one type of user can see and add blog post to site?

  • Did anyone figure out that problem where the only role displayed is "No specific role" and you can't change user roles?

    I have it installed but can't get past this.

  • Have you defined additional roles? The plugin has no UI it's just a framework, you must define them yourself in the code.

  • I have defined additional rules. (The documentation says that there are three default roles also. Those are not showing up.)

  • Hello, 
    I found this warning in roles plugins :

    PHP WARNING: "array_intersect(): Argument #2 is not an array" in file /var/www/honeybee/mod/roles/lib/roles.php (line 590),

    PHP WARNING: "implode(): Invalid arguments passed" in file /var/www/honeybee/mod/roles/start.php (line 254),

    I think we should check the second argument to be an array to prevent releasing these warnings in both cases.

Arck Interactive

You imagine. We create. We develop custom social networks, content management systems and other rich internet applications. We help entrepreneurs and creative agencies breathe life into their visions. Let's start a conversation!

Stats

  • Category: Uncategorized
  • License: GNU General Public License (GPL) version 2
  • Updated: 2017-5-27
  • Downloads: 9437
  • Recommendations: 44

Other Projects

View Arck Interactive's plugins