Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Ron Rennick

    (@wpmuguru)

    I explained in the thread that you linked to that the plugin does not load any scripts in the dashboard.

    There is no code in it that adds query strings to any script URLs (other than the one included in the plugin for remote login).

    Plugin Author Ron Rennick

    (@wpmuguru)

    As a secondary note ?ver=some-value on the end of a script URL will not cause it to 404. The ?ver=abc is for browser cache busting and does not affect the location of the file.

    You’ll only get a 404 if the script file doesn’t exist.

    Not sure if this is the same issue we encountered – but I was noticing on our multisite the subdomain (where we restrict logins to) showed the correct url to the plugins, but when on the live site domain it was like this: https://www.somesite.coms?ver=asdfsdf .. after tracing thru I found the issue in this plugin.

    One thing we do differently is we define the plugin, themes, upload paths in wp-config for our setup.

    The fix — in the domain_mappings_plugin_uri function there is this line:

    get_option( 'siteurl' ) . substr( $full_url, stripos( $full_url, WP_PLUGIN_URL ) - 1 );

    Removing the “-1” fixed it. Or better yet, we detect if its calling the plugin path from an absolute url or not.

    $_pos = stripos( $full_url, '://' );
            if( false === $_pos ){
                    $dm_plugin_uri = get_option( 'siteurl' ) . substr( $full_url, stripos( $full_url, WP_PLUGIN_URL ) );
            }else{
                    $dm_plugin_uri = get_option( 'siteurl' ) . substr( $full_url, stripos( $full_url, WP_PLUGIN_URL ) - 1 );
            }
            return $dm_plugin_uri;

    Again .. not sure if thats your same issue but it sounded similar enough.

    Plugin Author Ron Rennick

    (@wpmuguru)

    Did you edit the domain & path of the sites you are mapping domains to (in network admin -> sites -> edit site?

    Thread Starter Jo Sprague

    (@josiahsprague)

    Thanks @mardala, the issue I’m having is definitely related to that line. I just tried your fixes, and it ends up breaking more asset URIs than it fixes (instead of just one having an extra s appended, a bunch are missing the / before the query string. I’ll look into it a little more to see if I can figure out what’s going on here.

    Ron, I’m not sure what you mean about editing the domain and path of the sites in network admin -> sites -> edit site. The sites that I’m working on have been migrated several times, so I’m sure that field has been changed in the past, but I’ve checked and the current values look correct.

    Thread Starter Jo Sprague

    (@josiahsprague)

    Alright, I tracked down what the problem is. It’s related to mu-plugins. When the $full_url passed in was an mu plugin url, for example; “https://mysubdomain.com/wp-content/mu-plugins/force-strong-passwords/force-zxcvbn.min.js” the domain_mapping_plugins_uri() function was just taking the last character of the string (results of stripos -1) to be the plugin path since PLUGINDIR wasn’t found in the string. Rather than relying on a plugin directory constant, if I just parse the URL with PHP to replace the domain, it seems to work more reliably. I did this;

    // Replaces the domain in the plugins URL with the mapped domain for the site
    function domain_mapping_plugins_uri( $full_url, $path=NULL, $plugin=NULL ) {
    	$url_path = parse_url($full_url, PHP_URL_PATH);
    	$url_query = parse_url($full_url, PHP_URL_QUERY);
    	return get_option( 'siteurl' ) . $url_path . $url_query;
    }

    Of course, that will be overwritten next time I update. Ron, if you’d like I can try to make a PR, but I’m not sure where that’s done. Is there a Subversion repo somewhere?

    Plugin Author Ron Rennick

    (@wpmuguru)

    I’m glad you found it. That patch won’t work for all variations of installations.

    Arbitrary URLs are going to be included in WP 4.4 so eventually domain mapping will be retired/obsolete & I’m not expecting to be releasing a new version.

    Hi Ron,

    I’ve recently come across this issue and specifically on a managed WP hosting company that doesn’t yet recognize / support WP’s new built in capabilities. They are still recommending your plugin as the way to do multisite domain mappings.

    Any chance you’re able to save a few headaches.. (even for many people using the plugin that don’t know why their dashboard takes an extra 10 second to load) by making a small patch and putting in a new minor release?

    Plugin Author Ron Rennick

    (@wpmuguru)

    managed WP hosting company that doesn’t yet recognize / support WP’s new built in capabilities.

    Do you mean you are forced to run outdated versions of WP?

    If you are running the current version of WP & your host supports domain mapping then it also supports arbitrary URLs in WP core. There is no difference between the 2 methods outside of WP.

    After much searching we stumbled on this thread and it saved my sanity. We disabled the strong passwords plugin and this also worked adequately.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Adds "s/?ver=1.0" to admin scripts’ is closed to new replies.