• Resolved finnj

    (@finnj)


    Hi,

    I am the author of a plugin called Frontier Post, and one of my users has a couple of questions relating to both plugins working together:

    Is it possible in User Role Editor to create and maintain capabilities from other plugins. I have added own capabilities to wordpress capabilities ex: frontier_post_can_edit ?
    In that case I would implement a setting where I disable these capabilities, so the can be set in User Role Editor instead

    Second thing: do you expose a function that returns the active profile for a user, so it can be used from another plugin ?
    Ex:

    if (function_exists("usr_current_role"))
         $current_role = usr_current_role($userid);

    Original support case: https://wordpress.org/support/topic/how-to-assign-a-category-without-user-selection?replies=8

    https://wordpress.org/plugins/user-role-editor/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Vladimir Garagulya

    (@shinephp)

    Hi,

    1) if user capability really added to WP role by other plugin, it is available at User Role Editor at the custom capabilities section.

    2) There is no need in such function, use existing WordPress API.
    Look at WP_User object at wp-includes/capabilities.php. It contains all needed data.
    You may get user object with get_user_by() function:
    http://codex.wordpress.org/Function_Reference/get_user_by

    Current user is available globally as $current_user or via function wp_get_current_user()
    http://codex.wordpress.org/Function_Reference/wp_get_current_user

    Thread Starter finnj

    (@finnj)

    1: My problem is that the user capabilities is set by profile each time the settings are saved, that would conflict with user role editor – see the settings page: https://wordpress.org/plugins/frontier-post/screenshots/

    I use add_cap() and remove_cap() to change a users capabilities based on the users role.

    As far as I understand User Role Editor, a user can have multiple profiles, that will be joined to one set of capabilities for the users.

    So I can implement a setting: “Capabilities controlled by other plugin” , but if capabilities cant be added manually in user role editor, I don’t understand how they can be maintained in user role editor. If a capability is set to false, I remove the capability, and as such not available in user role editor.

    Can a user manually add capabilities ?

    2: sorry misunderstood the way user role editor works

    Plugin Author Vladimir Garagulya

    (@shinephp)

    1) Yes, user can add new capabilities manually with User Role Editor. But user should know exactly what capabilities he should add to work with your plugin. If your plugin add (upon activation) full capabilities set to the administrator role, user may turn on/off them for other roles at URE without need to create them manually.
    2) URE offers user interface to the existing WordPress API to manage user roles and capabilities. WordPress stores roles data at the database.
    http://shinephp.com/how-to-change-wordpress-user-role-capabilities/
    URE updates that data using WordPress API from capabilities.php

    Thread Starter finnj

    (@finnj)

    Hi Vladimir,

    Thanks for your prompt response.

    I will document the capabilities needed, and ensure that admin has all capabilities on activation going forward (I believe it is only one that isn’t activated already)

    Frontier also uses the API to manage roles and capabilities.

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Integration with User Role Editor’ is closed to new replies.