BuddyPress: Error message after login "you don't have permission to access this page"

When trying to log in from:
https://www.mysite.net/wp-login.php

The error shows up:
Log in from https://www.mysite.net/wp-admin/ is working well

  • Predrag Dubajic

    Hey Peter,

    Hope you're doing well :slight_smile:

    I had a look at your site and see that the issue here is that wp-login.php page is redirecting to wp-admin, which is blocked on your site for subscribers so they get the message about no access, while wp-admin page redirects to member BuddyPress profile which is of course available.

    You could try using some redirect plugins like below ones in order to redirect wp-login.php page to profile page as well:
    https://wordpress.org/plugins/peters-login-redirect/
    https://wordpress.org/plugins/bp-redirect-to-profile/

    Best regards,
    Predrag

  • Peter

    Hi Predrag,

    this is just another one of those weird issues with wordpress. This redirect problem only occurs when I start deactivating plugins. Haven't traced it 100% but it's probably happening when Buddypress or bbpress is deactivated.

    But that sill leaves the issue of my theme's popup login. It's the login link in the main menu (not the top menu) on the main site.
    It seems to have problems in creating the session cookie. Once I have logged in via wp-login.php I can use the popup login too and it works fine logging in and out repeatedly. But once I clear the browser cache the popup login stops working. Until I login via wp-login.php again and log out again. Then it starts working again.

    Hope that helps.

    Cheers,
    Peter

  • Predrag Dubajic

    Hi Peter,

    First of all, apologies for not restoring your language yesterday :slight_frown:
    I've changed the language for user directly from user profile so that's why you were unable to see Deutch even tho it was selected as general WordPress language, I've switched it back now.

    As for the login issues, so what happens with the popup when all of the plugins are disabled, does the same issue happen or it works fine in that case?

    Did you check if the wp-admin and wp-login.php are working with default WP theme?
    Perhaps theme login is conflicting with other login options used on your site.

    Best regards,
    Predrag

  • Peter

    Hi Predrag,

    don't worry about the language setting. It made total sense that you had changed it to English. I'm more upset with myself that I didn't think about checking if there is an option to change language on user level. Instead I was digging into wp-config and the likes and of course didn't find anything. Learned something new about Wordpress. I think my problem would have been way bigger if you had set language to Chinese :slight_smile:

    Login issue through theme's popup:
    I tried disabling all plugins. Also tried leaving those plugins active that Kleo Theme claims to be important to the theme. The other problem with not being able to login through wp-login.php only appeared when I started deactivating plugins. Which then left the question if both issues were related or just coincidental.

    I just tried again with deactivating everything. The problem with the popup login persists. It's not a huge problem since the regular login works with Kleo (but again: only when some critical plugins are active). But the popup integrates nicely with Facebook login so I would really like it to work.

    Hope that narrows things down a bit for you.

    Cheers,
    Peter

  • Adam Czajczyk

    Hi Peter,

    I was able to get my hands on the install with Kleo theme and do some testing, but I wasn't able to replicate this yet. The install was surely different than your, however Predrag noticed before that the "redirect" might be the issue here.

    To recap what he suggested: the login redirects to /wp-admin which is, on your setup, protected from access (thus giving "you don't have permission..." error).

    I wonder if changing that would help. On "Theme Settings -> Miscellaneous" page (in site's back-end) there's a "Login redirect for Popup" option that, I'm guessing, is currently set to "Default WordPress redirect". Could you change it to either "Reload the current page" (that would make user stay on the current page after login) or to "Custom Link" (setting link to some page that is *not* protected in any way), then clear all caches and see if that helps?

    Best regards,
    Adam

  • Peter

    Wow. Nasty shit this was. Adam.... I got it. On my fourth pint of beer. It's my f"§gh4&/ server. Again.
    They even had the solution printed in their troubelshooting guide. Which of course you only find once you know that it's the missing wordpress_test_cookie. No explaination as to why this is neccessary. Some things in the WP install could set off some server side security measures. And once they're triggered the only way to get rid of them is to reinstall WP or so it appears. That would explain why even uploading the backup files and DB from a working setup wouldn't get the site back into working state without this login issue. Leaves the question why RevSlider set it off. And if there are other plugins that can trigger it.

    And now for the drum roll..... Ladies and Gentlemen....

    RewriteEngine On
    RewriteCond %{REQUEST_URI} ^/
    RewriteRule .* - [CO=wordpress_test_cookie:WP+Cookie+check:%{HTTP_HOST}:1440:/]

    at the beginning of htaccess. Drops the missing test cookie. Voilá. Problem solved. Using regular wp-login.php also would drop the cookie and thereby temporarily solve the problem. Until chache got cleared and test cookie was gone again. So now I end up with two test cookies after login. Oh well.

    I hate my server.

  • Adam Czajczyk

    Hi Peter,

    Ouch, awww, ugh and phew :slight_smile:

    I'm so glad you were able to fix it! On the other hand, I'm now pretty ashamed that I didn't even notice that this cookie is missing, sorry about that... I mentioned a couple of times that it might be a cookie issue but I also checked those cookies numerous times on your site and still missed the missing one - as a result elimination it as a potential reason :slight_frown:

    Anyway, I'm really happy you found the solution and thank you for sharing it with us as I'm sure it might turn out to be very helpful for some other users in future too!

    Best regards,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.