Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multisite - If menu has a parent slug, the account urls will direct to 404 #674

Open
bfintal opened this issue Dec 4, 2023 · 0 comments

Comments

@bfintal
Copy link
Contributor

bfintal commented Dec 4, 2023

馃悶 bug report

What is the issue? (*)

If you have the following scenario, there is no way to access the account page. Also, all links in the account page will also direct to a 404:

  1. You have this SDK setting enabled:
'menu' => array(
    'parent'     => array(
        'slug' => 'options-general.php',
    ),
),
  1. You have the plugin network activated in a multisite

Looks like the function call fs()->get_account_url() gives an invalid URL / or a 404 page

Other findings

The call fs()->get_account_url() returns this URL which is inaccessible:

http://multisite.local/wp-admin/network/options-general.php?page=stackable-account

But if you change the URL to this, it works:

http://multisite.local/wp-admin/network/admin.php?page=stackable-account

Workaround

A workaround I've devised is to detect if the user is in multisite, main site and is network activated, then change the SDK setting dynamically:

$menu_slug = 'options-general.php';
if ( is_multisite() && is_main_site() && is_plugin_active_for_network( plugin_basename( __FILE__ ) ) ) {
	$menu_slug = 'admin.php';
}

What is the expected behavior?

It should go to the accounts page and all links in it should work.

@bfintal bfintal changed the title Multisite - If menu has a parent slug, the account page is inaccessible Multisite - If menu has a parent slug, the account urls will direct to 404 Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant