• Resolved arg0n

    (@arg0n)


    Helo

    I don’t understand one thing. I would like the user to have access to the list of users (without administrators).

    When I do something like this:
    add_role( ‘testrole’, ‘testrole’);

    $test_role = get_role(‘testrole’);
    $test_role->add_cap(‘list_users’);

    the user also sees administrators in the user list.

    When I add a role using the User Role Editor plugin and add list_users cap, the user has access to the list of regular users only.

    What is the difference between these two situations?

    Additionally, if I add a role via code, all I have to do is enable the plugin so that only regular users appear in the list (without admins).

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

    (@shinephp)

    Hi,

    URE plugin includes a piece of code to hide users with ‘administrator’ role from any other user who can ‘edit_users’ capability. When you activate URE, this code works by default.

    Thread Starter arg0n

    (@arg0n)

    Thank you for the information,

    I found this snippet in protect-admin.php

    (This also works with only list_users cap, without edit_users)

    problem solved

    • This reply was modified 1 year, 11 months ago by arg0n.
    • This reply was modified 1 year, 11 months ago by arg0n.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Differences between plugin and add_cap() function’ is closed to new replies.