Roles for Profile Manager v1.0.1

Release Notes

system messages fixed

  • Thank you for fixing the system message issue so quickly :)

  • Good to see something like this being developed. It was always one of the things we had in our mind when developing the profile type mechanisme. If you have any thoughts on how can we can improve this integration or if you ran into some issues regarding the profile manager, just let me know.

  • In simple terms, the profile types can be set to have a different set of roles for each one?

  • Good question TahoeBilly. Will recommend it and try it tomorrow! Nite!

  • @TahoeBilly, in simple terms, a given role is associated with a given profile type, i.e. one role per profile type, mutually dependent, a change in one triggers a change in the other. This basically allows you to define different profile fields for different roles.

  • In our case we have 3 profile/member types to start-

    #1 Type we only want to be able to make comments to photo albums and also to not be able to view much of the network, meaning groups and other areas are hidden from them.

    #2 Type we want to be able to use groups but not own groups but not own them and we don't want them using "files" plugin. We want to limit which plugins they can use.

    #3 Type we want to be able to be group admin groups, invite other group admins from off the system, give the other group admins various group "roles" i.e. manage a blog, or discussions.

    Can profile manager and the various roles plugins handle all this, of am I setting out a much complex set of customizing?

     

  • The simple answer is yes. That's exactly the purpose behind the 'roles' framework. This particular plugin just bridges roles with profile types, allowing each role to have a distinct set of fields in their profile.

  • THANKS! where is the love #black #white #peace #love

  • Please I need advice on how to transfer the settings from one install to another. I need to move the entire package of Profille Manager; fields, user types, categories and roles, if that makes sense.

  • Thanks to ark. Could it be possible to obtain from some one (not necessary ark) a little tuto with exemples. I am a little bit disappointed with the conf of this plugin.

    Thanks

  • Check the pdf documentation and take a look at the other roles Arck released. 

  • Hello in 1.8.8 there is an error that said  something like "The configuration variable cannot exceed 32 characters". I found a fix, which is to shorten your function name roles_pm_create_profile_types_from_roles into something like roles_pm_create_pt_from_roles.

  • How and where do I add different roles?

  • ok everyone Im trying to use role in conditional statement, like if user has role = RoleName { than do this....

    Right now I'm just trying to echo the role ( as described in the pdf doc file) but no role is showing. I have profile manager installed and all roles are created as it created those categories in PM.

    Here is my code:

    $user = elgg_get_logged_in_user_entity();
    $user_guid = $user->getGUID();

    //$myrole = roles_get_role($user = null);
    //$myrole = roles_get_role($user);

    $myrole = roles_get_role();

    echo 'Role:' . $myrole . '';

    anyone knows how to get this to show?

    Thanks.

  • can anyone shed some light here?

    Roles plugin gurus?

    Thanks.

  • @This Script Lover: roles_get_role() will return you an ElggRole object, note a string, so you won't be able to just 'echo' it. Use 'echo $my_role->name' to get the name of current user's role. Or use print_r($my_role) to see the whole object.

  • @ Andras, THANK YOU, that was the piece of puzzle I needed.

  • hoy i can call a function to add or update a role for example called "Student" with this plugin, which function i need to use?

  • OK guys How do one go about getting a list of users with specific role?

    I'm trying this but it's not working:

    $options = array('type' => 'user', 'full_view' => false, 'relationship' => 'has_role', 'role_name' => 'default', 'relationship_guid' => $user->guid,); $content = elgg_list_entities_from_relationship($options);

     I looked in the doc file but nothing there. What's the correct way to get list of users with specific role ?

    Thanks.

  • @Script Lover:

    First obtain the role object from the name via $role = roles_get_role_by_name($role_name) - see lib/roles.php for reference. This should return an ElggObject, assuming you passed a valid role name. Once you get the role object, use its guid in your relationship query.

    $options = array(
     'type' => 'user',
     'relationship => 'has_role',
     'relationship_guid' => $role->guid,
     'inverse_relationship' => true,
     'limit' => 0
    );
    elgg_list_entities_from_relationship($options);

    That should do it. Please note that users who do not have a specific, custom role (i.e. regular members and admins without other roles) will not be returned by this query. This was a deliberate design decision and serves efficiency, so the relationship table won't be filled with arbitrary role information. For getting all regular members having the DEFAULT_ROLE role, you'd need to construct a custom query on the users table, selecting all non-admin users, then LEFT JOIN the relationships table to fetch all users who do not have role specific relationships.

  • @Andras, Once again saving the day :)

    I did see bits and pieces in classes ElggRole.php and lib/roles.php but could not put 2&2 together.

    My role name is "super" so for getting role object do I use $role = roles_get_role_by_name(super)? or does it need to be in quotes :$role = roles_get_role_by_name('super')?

    I'll play with that but wanted to confirm the correct way.

    Thanks a lot.

  • That worked perfectly, Thank you very much.

    Now if you know a way, I need to get another user list that excludes users with that role. Basically list all users that do NOT have this specific role.

    Thanks.

  •  * To ask for entities that do not have a particulat relationship to an entity,
     * use a custom where clause like the following:
     *
     *     $options['wheres'][] = "NOT EXISTS (

  • Hey DDS :)

    So there is no special way in Elgg to exclude parametar from array like: 

    $options = array(
     'type' => 'user',
    'exclude' => 'has_role',

    I guess I'll try tinkering with "wheres' NOT EXISTS

    Thank you.

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: Third Party integrations
  • License: GNU General Public License (GPL) version 2
  • Updated: 2014-11-17
  • Downloads: 2568
  • Recommendations: 11

Other Projects

View Arck Interactive's plugins