Support » Plugin: Members - Role Hiearchy » Filtering editable roles

  • Resolved joelworsham

    (@joelworsham)


    This plugin filters get_editable_roles() via your function mrh_editable_roles(). It then removes the current user’s role. This is conflicting with the plugin Client Dash, and I expect it might conflict with other plugins too, as modifying the editable roles is a huge modification that a lot of plugins rely on.

    Could I ask why you are modifying this? And perhaps implore you do find another way?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Justin Tadlock

    (@greenshady)

    WordPress God

    The mrh_editable_roles() filter doesn’t remove the current user’s role. It removes roles from the editable roles list.

    The editable_roles filter hook in WordPress is the correct hook for this. It was added to WordPress for precisely the use case that this plugin handles. Here’s the history on that: https://core.trac.wordpress.org/ticket/8770

    If this is messing up the Client Dash plugin, it’s most likely the plugin is using the function incorrectly. The get_editable_roles() function’s purpose is to return an array of roles that the current user is allowed to edit.

    Reference: https://developer.wordpress.org/reference/functions/get_editable_roles/

    Thank you for the clarification, Justin. I suppose I had a misunderstanding of the use-case for that function.

    Thanks for taking the time to clear that up for me. I’ll access the global $wp_roles in the future for my use-case.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Filtering editable roles’ is closed to new replies.