humanmade / Mercator

WordPress multisite domain mapping for the modern era.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tab for domain mapping not showing anymore

0x7466 opened this issue · comments

Since the update to WordPress 5.5 or so the domain mapping tab is missing.
screenshot-2020 09 24-15_51_53

However, if I visit the domain mapping url (eg. domain/wp-admin/network/admin.php?action=mercator-aliases&id=1) directly, it opens up normally.

Looks like there is something wrong in this function in the admin.php:

/**
 * Output the site tab if we're on the right page
 *
 * Outputs the link, then moves it into place using JS, as there are no hooks to
 * speak of.
 */
function maybe_output_site_tab() {
	if ( ! is_network_admin() ) {
		return;
	}

	if ( $GLOBALS['parent_file'] !== 'sites.php' || $GLOBALS['submenu_file'] !== 'sites.php' ) {
		return;
	}

	$id = isset( $_REQUEST['id'] ) ? absint( $_REQUEST['id'] ) : 0;
	if ( empty( $id ) ) {
		return;
	}

	$class = ( ! empty( $_REQUEST['action'] ) && in_array( $_REQUEST['action'], array( 'mercator-aliases', 'mercator-edit' ), true ) ) ? ' nav-tab-active' : '';

?>
	<span id="mercator-aliases-nav-link" class="hide-if-no-js"><a href="<?php echo esc_url( network_admin_url( 'admin.php?action=mercator-aliases' ) . '&id=' . $id ); ?>" class="nav-tab<?php echo $class; ?>"><?php esc_html_e( 'Aliases', 'mercator' ); ?></a></span>
	<script>jQuery(function ($) {
		$( '#mercator-aliases-nav-link' ).appendTo( $( '.nav-tab-wrapper' ) );
	});</script>
<?php

}

Is it possible that the structure of the admin site has changed and now the inclusion doesn't work anymore?

Thanks!

i can confirm that the Aliases tab is missing, but I'm not sure if it's due to WP 5.5.0+. I have 2 nearly identical WMPU installs. Both have 5.5.1 installed, but have different versions of WooCommerce and several other plugins. The MU install with the older version of the plugins is the one that's still displaying the tab.

commented

Can't confirm this one. You might be running a plugin that has a JS error and is preventing the following from firing:

Mercator/admin.php

Lines 77 to 79 in 55e3f01

<script>jQuery(function ($) {
$( '#mercator-aliases-nav-link' ).appendTo( $( '.nav-tab-wrapper' ) );
});</script>

Check your browser's developer console to see if there are any JS errors.

@r-a-y Looks like that's the problem. It's working again so I haven't had the chance to identify the breaking javascript. But it's probably due to another plugin.

@splaquet Can you check the Chrome console for js errors?

I wasn't seeing any console errors on any of the tabs. But, when I manually added the aliases URI (admin.php?action=mercator-aliases), the following popped up:

[DOM] Found 2 elements with non-unique id #_wpnonce: (More info: https://goo.gl/9p2vKq) <input type=​"hidden" id=​"_wpnonce" name=​"_wpnonce" value=​"e25c55abc0">​
<input type="hidden" id="_wpnonce" name="_wpnonce" value="f7ff686452">

As I implied in my previous post, it would appear that there's a conflict with one of the updated plugins. My hunch is on WooCommerce.