Info
- 7 posts
- 5 voices
- Started 2 years ago by pinpin_lelapin
- Latest reply from damiencaselli
- This topic is not resolved
Loading bbpress after codeigniter
-
- Posted 2 years ago #
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,
-
- Posted 2 years ago #
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 ...
-
- Posted 2 years ago #
register_globalsis 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,$_COOKIEand$_SERVERand turns them into global variables (i.e. ?book=1 in the$_GETarray 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. -
- Posted 2 years ago #
Yes, indeed it is OFF, I thought it was the input class but it's not ... nvm ...
-
- Posted 2 years ago #
Most functions using globals, I think you need a class based forum script or you need to build your own bbpress objects
-
- Posted 2 years ago #
@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
-
- Posted 1 year ago #
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!
-
You must log in to post.