Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

How to add user role, use ACL in elefantcms

edited October 2012 in Framework

hello all, I intended to create user role, beside guest and admin which new role can edit his/her user profile change image, chat with other member, etc exactly like this discussions apps?

maybe, tutorial or snippet of code can help me :D

Thanks

Comments

  • Take a look at apps/user/conf/config.php. User roles are listed in the user_types setting in that file, and their access levels can be defined in the [Access] section of the same file. For example:

    user_types = "admin, member, client"
    

    And new access levels:

    client = type:client
    

    This just says that the access level "client" requires you to be a user of the type "client". There's more info on that in the comments in that file.

    Now you can use the new access level in your code like this:

    <?php
    
    if (User::access ('client')) {
        // passes
    } else {
        // not allowed
    }
    
    ?>
    

    Hope that helps.

Sign In or Register to comment.