• Resolved mikemayer67

    (@mikemayer67)


    I am new to plugin development and am looking through User Role Editor as to try to get my bearings. I am probably missing something very simple, but after a few hours looking through both code and documentation, I cannot find the magic that makes the following URL work:

    http://localhost/wordpress/wp-admin/users.php?page=users-user-role-editor.php&object=user&user_id=2&_wpnonce=xxxxxxxxx

    I have looked through users.php, but don’t see where it is parsing the page argument to redirect to users-user-role-editor.php.

    Moreover, there is no users-user-role-editor.php in anywhere in the plugin directory. There is only user-role-editor.php. I’m guessing the same magic that performs the redirect also strips the initial ‘users-‘ from the path.

    Any help to get my looking in the right place to understand the parsing of that URL would be appreciated

Viewing 2 replies - 1 through 2 (of 2 total)
  • I didn’t look at the code, but I think the page that is loaded is still users.php. The other parameters are used by code the plugin has to check for that specific page name.

    Thread Starter mikemayer67

    (@mikemayer67)

    So, after more than a couple more hours of banging my head against this, I figured this out. I’m sharing the solution just in case someone else finds themselves here looking for something similar.

    The answer to the first question can be found in wp-admin/admin.php.
    It starts when users.php loads admin.php via a require_once call.
    Inside admin.php, if the page= attribute is part of the (GET) URL, the associated value is used to invoke both the “load-{$page_hook}” and the $page_hook actions. In this case:
    do_action('load-users_user-role-editor')
    and
    do_action('users_user-role-editor')

    The answer to the second question can be found in the plugin itself. The difficulty in finding it was that the tag was built up through a concatenation of strings and thus not directly findable with grep or find in vim.

    • This reply was modified 6 years, 10 months ago by mikemayer67.
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘options.php?page=’ is closed to new replies.