Skip to:

Logout leads to a 404 (deep integration)

  • kirkpatrick


    I have a deep integration of bbPress 1.0.2 and WordPress 2.8.4 at, using a heavily modified Kakumei template.

    Integration works well. I only register users from WP. Logins work from either BBP or WP. WP users appear correctly to BBP (every user can log in from both WP and BBP)..

    Logout from WP is fine regardless of where the login occurred (so, no cookie problems).

    However, when logging out from BBP (using the Kakumei “Log out” link), the logout occurs (so cookies are working), but I am redirected to a 404. The logout link is bb-login.php?logout=1. I have found that, on the other hand, the link bb-login.php?logout=0 (as typed in) works just fine — logs out, redirects back to page.

    I have hacked a solution. I don’t understand it (I haven’t yet been able to follow the use of the GET variable logout to find where it’s value is used anywhere). But in case anyone else has this problem, here’s the hack.

    The logout link is produced by the function call bb_logout_link(); in the template’s logged-in.php file.

    bb_logout_link is defined in, and effectively calls bb_get_logout_link with the same arguments. In the latter function, around line 2737, the value logout=1 is hard-coded.

    I have changed the code for bb_get_logout_link so (a) it defaults to logout=1 if logout is not specified in the call to bb_logout_link (thus the hack is non-destructive), but (b) the call bb_logout_link(‘logout=0’); overrides the default.

    This produces the working link, so the “Log out” link works.

    Here’s the code

    Old line 2737 of was

    $query = array( 'logout' => 1 );

    I changed that to the following (which works because the args were “extract”ed, so $logout has a value from the call to bb_logout_link):

    if ( $logout==NULL ) $logout = 1;  // Defaults to 'logout=1'
    $query = array( 'logout' => $logout ); // Changed '1' to '$logout'

    Then in the template’s logged-in.php, I added the argument to the call to bb_logout_link:


    It works for me.

    Has anyone else has had this problem? If not, I must have broken something somewhere else — so I’d like to know.

    Can anyone explain the bug, or explain where the value of logout is used? (I’ll keep looking, and will post a followup if I find it, but I’m not expert at the subtleties of apply_filters, which appears to be the only possibility.)


  • You must be logged in to reply to this topic.
Skip to toolbar