Trying to access the network admin logs us out

Have a really weird issue that we tried to pin down during a live chat session, but I unfortunately had to leave the chat before we could figure this out.

When we login to the site admin, we are unable to access the network admin unless we first login to a subsite as well.

If we do not login to a subsite first and try to access the network admin, we're logged out of the site. See? Told you it was weird. :slight_smile:

  • Gem
    • Flash Drive

    Firstly, Thanks Patrick for your help so far, I think this problem is a "defender" issue, I managed to log in by disabling the plugin. I then went the hub and from the "Security" tab I activated defender but then I was no longer able to log into network admin. I was also unable to turn off defender in the hub tab. I think perhaps the underlying cause may be due to masking? not 100% sure but ultimately I really need your expert help here. I think if you are able to deactivate defender from the hub tabs (the plugin is already disabled), you will be able to get into network admin then look further into the issues and hopefully find cause and a solution. Many Thanks, Gem

  • Dimitris
    • Support Star

    Hello there Gem,
    hope you're doing well today!

    I just tried to log in to WP with the credentials you shared during the live chat with Patrick, I was being redirected to the login screen every time.

    I then added the following lines in the wp-config.php file:

    define('WP_HOME','http://yourdomain.com');
    define('WP_SITEURL','http://yourdomain.com');
    and I was able to login.

    I wasn't able to find the source of that though and even temporarily renaming the wp-content/plugins/wp-defender folder in order to deactivate it, didn't make any change.

    Before pushing this to our Second Level Support team, would it possible for you to create a staging site, so we are not making tests in the live site? I can see that cPanel gives you this functionality:
    https://www.siteground.com/tutorials/staging/
    When this is done, please proceed with a conflict test to be sure that there isn't anything else conflicting there. Just deactivate all plugins from both network and the main site, use a default theme like TwentySeventeen and see how that goes and if you can access all dashboards with a single sign in.

    Warm regards,
    Dimitris

  • Gem
    • Flash Drive

    Hi, I have reached out to Siteground re the error with staging and I got this response:

    Kristiyana L.: I'm afraid that Staging is not fully compatible with WordPress Multisite, that's the reason why it's not working right now. It only works with standard WordPress websites.

    Your help resolving this further would be very much appreciated.

  • Gem
    • Flash Drive

    Also when I activate defender again and then try to log out of a sub site i get the following error (all pointing towards a problem with masking, can you please remove masking or can you force remove defender? if you do remove defender , will the masking be removed and defaulted to wp-admin?

    I REALLY NEED URGENT HELP, I CANNOT WORK.

  • Pawel
    • Staff

    Hello Gem!

    I hope you're well today!

    We're very sorry for the longer waiting time for a response. We needed to find a fix for the issue you're experiencing. Just a tiny note: we're handling tickets from oldest to newest so when you post a reply, your ticket automatically jumps back to the end of the queue :slight_frown:

    As for the issue, I used cPanel access to check your database and I found a Defender's entry that's controlling the masking. It's located in the sitemeta table under meta_key = wd_masking_login_settings. I edited this entry and switched masking off. This allowed me to finally log in to your site using the credentials you provided during the Live Chat session.

    Please check if that fixed the issue for you.

    Kind regards,
    Pawel

  • Gem
    • Flash Drive

    Hi Pawel, this issue is still present and now I cannot log into network admin at all, as this is an issue caused by defenders masking a plugin supplied by WPMU Dev which is causing me months of issues which is greatly affecting my business and my multisite security can someone please help me to sort this out once and for all.

    Kind Regards,

    Gem

  • Gem
    • Flash Drive

    Dear Pawel,

    I have been on chat with neel Gajjar this morning, problem still persists, I'm able to login to the Network admin but there still seems to be an issue regarding Defender Mask Login, can you please check? DB table
    Please take a backup before altering anything in the site
    Also I get logged out and cannot log back in when trying to grant support access in wpmu dash.

    Could you please reach out to neel and help resolve this with thanks, Gem

  • Nastia
    • Support Rock Star

    Hello Gem

    I trust you're doing well!

    I've checked your site and with the Defender plugin deactivated, after loading network admin the user is being logged out. So I am afraid this is not caused by the Defender plugin.

    Current site structure goes as follows:
    - There site built with a domain name without www. So all blogs in the database do not have the WWW at the front.

    - The wp-options table has the WWW home URL and Site URL added

    - In the wp-config.php the define('WP_HOME..)' and define('WP_SITEURL'..) contains a link with WWW

    - After logging in to the main site and clicking on the network admin, the site starts loading the URL without www, since the URL in the database is http://www.domain.com, it is redirecting there and forcing an account to be logged out. Practically the site http://www.domain.com and domain.com are completly different domains.

    A solution here is to remove the WWW from all links within the database. Please have a full database backup before proceeding.

    Login to your cPanel and open phpMyAdmin.

    Click on the main database and open a SQL tab

    Past the following code inside the SQL field:

    UPDATE wp_options SET option_value = replace(option_value, 'https://www.domain.com', 'https://domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
    
    UPDATE wp_posts SET guid = replace(guid, 'https://www.domain.com','https://domain.com');
    
    UPDATE wp_posts SET post_content = replace(post_content, 'https://www.domain.com', 'https://domain.com');
    
    UPDATE wp_postmeta SET meta_value = replace(meta_value,'https://www.domain.com','https://domain.com.');

    Please replace the http://www.domain.com and domain.com with your main domain. Replace as well the wp_ prefix on tables with your actual database prefix

    Make sure to edit the wp-cofig.php again and remove the WWW from WP_HOME and WP_SITEURL .

    Please note, that this change may affect your SEO, so please add a 301 redirect from WWW to the main site.

    Let us know if you have any further questions.

    Kind regards,
    Nastia

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.