Skip to:
Content
Pages
Categories
Search
Top
Bottom

Logout error when bbPress plugin is active


  • soggybiscuit
    Member

    @soggybiscuit

    Hi

    I have a logout issue which shows an error when I logout of the admin area. The error is:

    Not Found

    The requested URL /forum/forum/wp-admin/edit.php was not found on this server.

    The WordPress installation is at /forum on the domain and bbpress seems to have added another /forum to the url. If I take that out of the url, it logs out as it should.

    If I deactivate the plugin (it’s the only plugin in the WP install) it logs out as it should.

    Could anyone throw any light on what might be happening please and how to fix it?

    Thanks

Viewing 25 replies - 1 through 25 (of 26 total)

  • Anthony
    Member

    @adzbierajewski

    This is a bug with the plugin, the plugin doesn’t expect the /forum to be there so it adds its own, causing a conflict with the site. Maybe contacting the plugin creator and telling him about this bug will help.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    @soggybiscuit – You can turn off the root slug in the Forum Settings, but it might still get confused.

    @Anthony – Not a bug with the plugin.


    soggybiscuit
    Member

    @soggybiscuit

    Thanks John, your reply is much appreciated.

    Thanks Anthony too for your input.

    I am going to install at the root level so hopefully this will resolve itself by doing that.

    @JohnJamesJacoby – First off, excellent work. Beautiful system. However, sorry to disagree with you, but I believe Anthony is right that there’s a problem with the plugin with both logging in and logging out (particularly when using the sidebar widget). Here’s why…

    I’m testing with the bbPress RC4 installed in a WP 3.2.1 Network config using sub-directory instead of sub-domain (no BuddyPress installed, just bbPress … no other plugins installed. – I have also tested with another sidebar login plugin and everything worked fine, but I’ve uninstalled it, and when I use the bbPress login widget I get problems.) If I use the bbPress login widget and enter the right credentials it logs me in and redirects me to [site]/[site]/ which obviously a problem.

    When I inspect the Login button element for the bbPress login widget I see:

    <div class="bbp-submit-wrapper">
    <input class="user-submit" type="submit" tabindex="104" value="Log In" name="user-submit">
    <input type="hidden" value="1" name="user-cookie">
    <input type="hidden" value="http://[host]/[site]/[site]/" name="redirect_to">
    <input id="_wpnonce" type="hidden" value="299cce3d83" name="_wpnonce">
    <input type="hidden" value="/[site]/" name="_wp_http_referer">
    </div>

    Since the problem is with the redirect_to hidden value, my guess is that there’s a problem with either

    $redirect_to = apply_filters( ‘bbp_user_login_redirect_to’, ” );

    or

    bbp_redirect_to_field( $redirect_to );

    which are called from bbp_user_login_fields() in the bbp-user-template.php file.

    ….

    Moving on to Log out

    If you correct the URL so that you’re back a the page for your site, you can now see the Gravitar, your name, and the log out link.

    Again, inspecting the log out element we get:

    <a href="http://[host]/[site]/wp-login.php?action=logout&_wpnonce=c08ad91218&redirect_to=http%3A%2F%2F[host]%2F[site]%2F[site]%2F%3Floggedout%3Dtrue">Log Out</a>

    Again, the link to the wp-login.php is fine… it’s the redirect_to afterwards that has the site name twice that’s the problem.

    I’ve also noticed that if the bbPress plugins is activated the WordPress meta for log out includes the redirect_to [site]/[site]/

    If the bbPress plugin is deactivated the native WordPress meta for log out reverts back to normal (without the redirect_to).

    With bbPress installed:

    <a href="http://[host]/[site]/wp-login.php?action=logout&_wpnonce=07d2823a80&redirect_to=http%3A%2F%2F[host]%2F[site]%2F[site]%2F%3Floggedout%3Dtrue">Log out</a>

    Without bbPress installed:

    <a href="http://[host]/[site]/wp-login.php?action=logout&_wpnonce=07d2823a80">Log out</a>

    Hello…

    This problem is a real one and must be corrected…… As WP blogs are often NOT at root level !

    And it is caused by bbPress itself…. if deactivated, all is OK.

    I hope this can be solved….

    regards.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Patches welcome. :)


    soggybiscuit
    Member

    @soggybiscuit

    Hi

    I have found a patch that has worked for me and perhaps you may want to incorporate it into the plugin….

    This is not my fix – details can be found at:

    http:// brassblogs.com /cms-platforms/wordpress/wp_logout_url-agh

    It worked for my installation so perhaps will be of general use.

    Cheers


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    That won’t be a good fix. Looking into making the redirect smarter.


    bbpressHermit
    Member

    @bbpresshermit

    Anyone else have any temporary fixes or patches? I’m running into the same problem.

    I’ll be spending some time to see if I can come up with something.

    I was having the same issue, but it’s working now.

    I’m sure it’s not the perfect fix, but it works for now.

    bbp-includes/bbp-common-template.php

    line 1751

    Changed : wp_logout_url( $redirect_to )

    to : wp_logout_url( home_url() )

    Please share your experiences.

    Thanks


    bbpressHermit
    Member

    @bbpresshermit

    Seems to be working fine for me, did you run into the same problem with logging in as well? or user registration?

    I seem to have the same error for anything that is being redirected, it adds the subdirectory name twice… domain.com/subdir/subdir… which always returns a 404.. I can use a .htaccess redirect but it is an ugly fix.

    I had the same problem with login, when I tried doing what mixlplex2 above explained.

    Tried some other options on https://codex.wordpress.org/Function_Reference/wp_logout_url

    but that seems to be the best one for now.

    The change to bbp-common-template mentioned above solved this issue for me too.


    sjd4
    Participant

    @sjd4

    The change for bbp-common-template.php worked for the logout, but for the login for the widget I had to comment out lines 938 and 939:

    //$redirect_to = apply_filters( ‘bbp_user_login_redirect_to’, ” );

    //bbp_redirect_to_field( $redirect_to );

    I still have problems using the the WordPress meta for log out. Has anyone figured anymore of this out?


    sjd4
    Participant

    @sjd4

    Oops I meant to say lines 938 and 939 in bbp-user-template.php.


    bbpressHermit
    Member

    @bbpresshermit

    Another trick is to redirect via .htaccess. Ugly but it works.


    sjd4
    Participant

    @sjd4

    Yeah, I eventually uncommented the code and went the .htaccess route. I was hoping someone with more php experience or a developer could identify the issue based on those few changes.

    The bbp-common-template.php edit didn’t work for me.

    Could someone share the .htaccess redirect.


    sjd4
    Participant

    @sjd4

    RewriteEngine on

    RewriteCond %{HTTP_HOST} ^yourdomain.com$

    RewriteRule ^folder/folder/?(.*)$ “http://yourdomain.com/folder/$1″ [R=301,L]

    Sorry, my ISP requires a lot of escapes


    sjd4
    Participant

    @sjd4

    Did that work for you juggledean?

    Unfortunately my folder is named wp. The rewrite did remove the second occurrence of the folder but it also removed the wp in wp-admin, so it didn’t work for me.

    I followed soggybiscuit’s path, that’s working so far.

    The edit from atiminou3 worked for me. Thanks!


    biznisoka
    Participant

    @biznisoka

    Hi,

    Found this topic, I know it was quite a long time ago, but it seems i have the same problem (after user logout (using the widget login) it opens a 404 error page).
    I can’t find the bbp-includes/bbp-common-template.php so where can i find the “wp_logout_url( $redirect_to )” line?
    I assume the bbp plugin folder and file structure might have changed in the last 9 years..
    Have the 2.6.6. version.


    Robin W
    Moderator

    @robin-w

    ok, this thread was for version 1 of the plugin.

    If you have an issue, it could be a theme or plugin issue

    Themes

    As a test switch to a default theme such as twentytwenty, and see if this fixes.

    Plugins

    If that doesn’t work, also deactivate all plugins apart from bbpress and see if this fixes. if it does, re-enable one at a time to see which is causing the error.

    If you cannot do this to your site (say because it is live) then use the ‘troubleshooting’ features of this plugin to let you test without affecting other users

    Health Check & Troubleshooting

    Then come back


    biznisoka
    Participant

    @biznisoka

    Changed the theme, but the issue was still there.

    I now found this solution, it worked for me:

    add_action('wp_logout','ps_redirect_after_logout');
    function ps_redirect_after_logout(){
             wp_redirect( 'your url here' );
             exit();
    }
Viewing 25 replies - 1 through 25 (of 26 total)
  • You must be logged in to reply to this topic.
Skip to toolbar