Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Michael Simpson

    (@msimpson)

    The plugin doesn’t support selecting custom role types. But the roles themselves just map to capabilities:

    ‘Administrator’ => ‘manage_options’
    ‘Editor’ => ‘publish_pages’
    ‘Author’ => ‘publish_posts’
    ‘Contributor’ => ‘edit_posts’
    ‘Subscriber’ => ‘read’

    So theoretically, if you set CFDB role to be able to edit to ‘Author’ for example, and your custom role has capability ‘publish_posts’ then it should work. But I haven’t tried it.

    Hrm… I get what youre saying…but. I made a role with only ‘read’ caps, then i set cfdb to ‘subscriber’ and it works, that user only sees the dashboard and the cfdb screen.

    The problem is, if this site allowed basic subscribers, they would be allowed to see and edit (we just purchased the edit plugin) the data.

    Perhaps in CF7DBOptionsManager.php, in canUserDoRoleOption() the returned value could have a filter put on it. Then, I could set the options to ‘admin’ but in a separate filter, return true, if the user is my custom role. (just quickly looking at your code, here.)

    So, yeah, I just hacked your CF7DBOptionsManager.php canUserDoRoleOption() and added a filter. It works, as far as i can tell. Do you think that will create a problem? Can you add the filter to the plugin?

    $bool = $this->isUserRoleEqualOrBetterThan($roleAllowed);
    return apply_filters('cf7db_canUserDoRoleOption', $bool);

    bah… whoops, no that didnt work, yet. I think I’d have to add the same filter to your calls to add_admin_page (or whatever that func is)

    Yep, a filter on createAdminMenu()the caps in the add_menu_page()call would need to be filtered.

    I then put a custom ‘use_cf7db’ capability on my custom role and administrator.

    Not exactly easy for the plug-n-play folks, but an easy couple filters for you and then us devs can use a couple filters and make this work.

    Plugin Author Michael Simpson

    (@msimpson)

    I’d have to rewrite that code to handle custom roles properly.

    Thread Starter vbk100

    (@vbk100)

    Michael Simpson,

    I’d have to rewrite that code to handle custom roles properly.

    Some plugins have a feature where admins can set capability rather than roles. For example, edit_themes can be used if we want only admins and some specific users who have that capability to access the plugin or it’s menu/menu-items or pages.

    If you could introduce that feature by offering some major capabilities like edit_themes, ‘read_private_posts’,’manage_options’,’manage_woocommerce’ we will be able to allow specific users with particular capabilities to access CF7DB’s plugin pages.

    Thank you!

    He already has most of that, except manage_woo. The problem with going by standard caps is you get lower-level users who ‘dont need to know’ getting access or having to elevate the ‘office person’ up to admin or editor, to allow them into the db.

    So,
    I have a custom capability that I add to the standard admin/editor, plus my custom ‘office person’ role. So far, I’ve made it work by inserting two filters into Michael’s plugin code.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Can't set custom roles’ is closed to new replies.