Support » Plugin: User Role Editor » Get capabilities from "Other role" on saving profile

  • Resolved RobinWebber

    (@robinwebber)


    Hi there,

    I’m trying to figure out how I can get the capabilities from the “Other roles” within the ‘profile_update’ action. I tried with user_can($user->ID, ‘custom_capability’), but it doesn’t receive the capabilities from the “Other roles” in this way. When I add to capability to the primary role, it does work.

    Could you tell me how I can detect all the capabilities together from the primary and other roles like this?

    Thank you!

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

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

    (@shinephp)

    Hi,

    Look at wp-includes/capabilities.php WP_User object structure.
    Properties $user->allcaps and $user->roles should help you.

    /**
    	 * All capabilities the user has, including individual and role based.
    	 *
    	 * @since 2.0.0
    	 * @access public
    	 * @var array
    	 */
    	var $allcaps = array();

Viewing 1 replies (of 1 total)
  • The topic ‘Get capabilities from "Other role" on saving profile’ is closed to new replies.