Support » Plugin: User Role Editor » Settings not saved: maybe issue with Domain Mapping?

  • Hi,
    I’ve an issue with multisite installations with mapped domains (using WordPress MU Domain Mapping).
    When I try to save URE settings on a blog with mapped domain, the URE settings are not saved. There isn’t any notice.

    Steps to reproduce:

    1. login in a blog with mapped domain: e.g. the original WP url is blog-1.example.com, the mapped domain is blog-1.com
    2. visit the URE setting page: e.g. http://www.blog-1.com</wp-admin/users.php?page=users-user-role-editor.php
    3. If you change some options and save, nothing is saved.

    I’ve found a potential cause. Following the above example, even if the URE admin url is “www.blog-1.com</wp-admin/users.php?page=users-user-role-editor.php”, the action attribute of URE form uses the original not-mapped url:

    <form id="ure_form" method="post" action="http://blog-1.example.com/wp-admin/users.php?page=users-user-role-editor.php">

    If I manually change the action url using browser console and then save settings, the changes are saved.

    I see in plugin code (https://plugins.trac.wordpress.org/browser/user-role-editor/tags/4.58.3/includes/classes/editor.php#L1311) that the action attribute uses a constant URE_WP_ADMIN_URL:

    <form id="ure_form" method="post" action="<?php echo URE_WP_ADMIN_URL . URE_PARENT . '?page=users-' . URE_PLUGIN_FILE; ?>" >

    URE_WP_ADMIN_URL is defined early in https://plugins.trac.wordpress.org/browser/user-role-editor/tags/4.58.3/includes/define-constants.php#L12.

    If I replace URE_WP_ADMIN_URL with admin_url(), the mapped domain is properly printed:

    <form id="ure_form" method="post" action="<?php echo admin_url() . URE_PARENT . '?page=users-' . URE_PLUGIN_FILE; ?>" >

    Maybe URE_WP_ADMIN_URL is defined too early, before that the filters by Domain Mapping are applied.
    Please can you have a look at it? Thanks!

    • This topic was modified 2 months, 1 week ago by eventualo.
    • This topic was modified 2 months, 1 week ago by eventualo.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Vladimir Garagulia

    (@shinephp)

    Good point! Thank you for the detailed report.
    I will include a fix to the next update.

    Plugin Author Vladimir Garagulia

    (@shinephp)

    Hi,

    I prepared updated version 4.59 to publishing. It includes the related update:

    * Update: PHP constant URE_WP_ADMIN_URL was replaced with direct ‘admin_url()’ call to respect the ‘admin_url’ filter applied by the get_admin_url() WordPress API function.

    It is available currently as development version from the bottom of Advanced View. It would be good if you test it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.