Skip to:

integrating with external authentication system

  • Hi,

    I’ve been working on integrating bbPress with a website that already has its own user database and login system. I already set it up to keep the bbPress database and the site database synchronised, so that registering as a site user will simulate registration in bbPress. The last step is to make bbPress recognize my site’s cookies, which I’m trying to do through a plugin.

    I’ve been trying to figure out which functions I need to rewrite in order to make this possible. I know there are a handful of functions in which I can replace in my plugin, but I’m not clear on how they connect with everything else in bbPress.

    Basically, I have a function that determines whether a user is currently logged in, and what that user’s ID number is. I just can’t figure out where to put the function. (The site uses its own login form, so I don’t need to worry about bbPress’ login process.)

    I found a few old posts where people were trying to do similar things, but no clear answers. Any pointers would be appreciated.



Viewing 5 replies - 1 through 5 (of 5 total)
  • Actually, to be more specific, it looks like I should be replacing one of the following functions: bb_auth(), bb_is_user_authorized(), bb_is_user_logged_in(), or bb_get_current_user().

    However, I’m not sure which ones to leave alone (in case they are used by other parts of the application), or how to specify the user ID.

    Still trying to figure this out–I think I just need to find the place where bbPress finds out the ID of the current user, and insert my own function.

    I looked in class.wp-auth.php as well as pluggable.php. As a test, I tried changing the validate_auth_cookie and get_current_user functions to “return XXXXX” in order to login user XXXXX automatically, but it didn’t work. I’m not sure if I’m changing the right functions, or if I’m returning the wrong information.

    Is the ID number enough information to log a user in?

    Where does it need to be provided?

    There are a number of old threads with similar questions, but it seems like nobody has found an answer…

    Thanks again!

    Oh, last post was a mistake. :)

    I finally figured it out. I was right with the last thing I tried…the function to change was validate_auth_cookie, which should return an integer representing the user ID. (It wasn’t working because I hadn’t yet set that user’s capabilities in the database.)

    So, for anyone trying to do the same thing: the function that needs to be rewritten is validate_auth_cookie in class.wp-auth.php. Write your own function to validate the cookie, and return a user ID (int).

    I had that same problem when trying to make only one register & only one login from my site with bbpress integration.

    register is easy, I just wrote directly to the db from php using the hash classes included. but for login i made a kind of webservice. When I login from tomcat I just request the next url…

    and i wrote the next code for bb-login-check.php


    // Load bbPress.


    // Redirect to an SSL page if required.


    $user = bb_login( @$_GET, @$_GET, @$_GET );

    if ( $user && !is_wp_error( $user ) ) {

    echo “0”;//login successfully



    echo “1”; //login fail




    i hope that’s usefull…

    for any question or help needed for bbpress or wordpress try fran.rod.rod [at]

    Wilson Pilar



    I do like [panchz] but i cannot include it in my function login. I dont know why! but the globals vars lost in the script!

    then i make this and works fine!


    * Function login from my system


    function login() {

    $login = $_POST;

    $password = $_POST;

    require INCLUDE_PATH.’forumbb-load.php';

    $schemes[] = ‘auth';

    $schemes[] = ‘logged_in';

    $expiration = time() + 172800;

    $expire = 0; /* 0 or 1*/

    foreach ( $schemes as $scheme ) {

    $wp_auth_object->set_auth_cookie( USER_ID , $expiration, $expire, $scheme );


Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.