Skip to:
Content
Pages
Categories
Search
Top
Bottom

Loading bbpress after codeigniter


  • pinpin_lelapin
    Member

    @pinpin_lelapin

    Hi,

    I’m trying to integrate a bbpress forum into an existing codeigniter application. (which basically just means integrating the login/logout/update/register functions and syncrhonizing the databases).

    I managed to do so by loading bbpress (simply including bb-load.php) on top of codeigniter and just calling the usual bb_login(), bb_logout() functions whenever needed.

    However, I just realised that loading it that way drastically decrease performances (went from ~200 req/sec to ~10).

    I now try to load bbpress just when I need it, but some strange things happend when bb-load.php is included AFTER codeigniter itself.

    e.g, if bb-load.php is included anywhere before codeigniter/CodeIgniter.php, it works, if included after, it won’t load.

    Basically what happened is that variables instantiated in the included scripts (like bb-load.php, or bb-settings.php for instance), are then ‘lost’ when reused as global variables elsewhere in bbpress files.

    (for now the variable that cause me troubles if $bbdb, which is fine while still in settings.php, but is empty in others files/functions …)

    I guess it may not only been related to bbpress but that’s the first time I see this … Anyone got this problem before ? Didn’t have much luck with Google …

    Thanks in advance,

Viewing 6 replies - 1 through 6 (of 6 total)

  • pinpin_lelapin
    Member

    @pinpin_lelapin

    couldn’t find the edit button :

    I didn’t fix this issue yet but I got a hint.

    the CodeIgniter’s input class (automatically loaded) destroys all global variables in the event register_globals is turned on.

    hope someone else might find this useful …

    register_globals is a gaping security flaw that’s been turned off in every recent PHP version. If you have it on, PHP takes anything passed by $_GET, $_POST, $_COOKIE and $_SERVER and turns them into global variables (i.e. ?book=1 in the $_GET array becomes $book = 1). I’d recommend turning it off ASAP.

    The edit link turns itself off after a while, it’s not just limited to if anyone else has posted :)

    Ah, and good luck integrating bb-load.php, I could never get it to even play nice with WordPress.


    pinpin_lelapin
    Member

    @pinpin_lelapin

    Yes, indeed it is OFF, I thought it was the input class but it’s not … nvm …


    Olaf Lederer
    Participant

    @finalwebsites

    Most functions using globals, I think you need a class based forum script or you need to build your own bbpress objects

    @pinpin_lelapin:

    Did you get things working? Me too interested in getting a simple and clean forum working with an existing login system on codeigniter.

    /T


    damiencaselli
    Member

    @damiencaselli

    I just happened to stumble upon this problem using both codeigniter and bbpress, and the solution was to plain remove all variables settings by references, and let the plain old “=” do the job (thanks @ Cyril Janssens).

    For some reason it doesn’t work if you let those references.

    Edit: You also need to specify global $bbdb, global $whateverVar in your controller, or you’ll get the same errors.

    Cheers!

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