WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Gallery
Roles Hardcode (with custom roles) (3 posts)

  1. Elan42.com
    Member
    Posted 1 year ago #

    Hi ! I'm trying to let a customized user see the nextgen gallery menus.

    This is the code that creates the user:

    add_role('customer', 'Customer', array(
                    'read' => true
                    (etc)
            ));

    Then I tryed with this for Nextgen Gallery menus:

    add_role('customer', 'Customer', array(
    'general' => true,
    'tinymce' => true,
    'add_gallery' => true,
    'ngg_manage_gallery' => true,
    'manage_others' => true,
    'manage_tags' => true,
    'edit_album' => true,
    'change_style' => true,
    'change_options' => true
            ));

    But it's not working. I also tryed:

    $role = get_role( 'customer' );
    $role->add_cap( 'general' );

    Can you help me ?

  2. Elan42.com
    Member
    Posted 1 year ago #

    Looking at NextGen Gallery code (admin.php file) I found this name in the add_menu calls, but they don't work:

    add_role('customer', 'Customer', array(
    'nggallery' => true,
    'nggallery-add-gallery' => true,
    'nggallery-manage-gallery' => true,
    'nggallery-manage-album' => true,
    'nggallery-tags' => true,
    'nggallery-options' => true,
    'nggallery-style' => true,
    'nggallery-roles' => true,
    'nggallery-about' => true,
    'nggallery-setup' => true
            ));
  3. Elan42.com
    Member
    Posted 1 year ago #

    I found a solution !!! This seems a bug to me, the menu pages are registered with their names, not with the slug. So this is the solution:

    add_role('customer', 'Customer', array(
    'NextGEN Gallery overview' => true,
    'NextGEN Upload images' => true,
    'NextGEN Manage gallery' => true,
    'NextGEN Edit album' => true,
    'NextGEN Manage tags' => true,
    'NextGEN Change options' => true,
    'NextGEN Change style' => true
    ));

    It's still not clear how to give the "manage_others" role. Actually this user can't edit other's galleries.

    Can some developer answer please ?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic