MyBB Community Forums

Full Version: Integrating MyBB into your website. (Login Form)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
When I put just
define("IN_MYBB", 1);
in the page.tpl I get
Direct initialization of this file is not allowed.

Please make sure IN_MYBB is defined.

But, when I put

<?php
define("IN_MYBB", 1);
chdir('forum'); // path to MyBB
include './global.php';
?>
in the page.tpl I get
Fatal error: Call to a member function on a non-object in /homepages/44/d185031242/htdocs/ing/forum/inc/class_datacache.php on line 42

Any more ideas?
there's a phpbb module for drupal that you may want to look at to see how they did it. It may give you an idea of how to fix it.
Hello everyone!

well this is mi first post, so i beg you some patience for me and my awfull writting (this is not my language) Smile

i've been reading this thread(as guset of course) since the beginning and i've tryed to implement it on my website(a game website, it doesn't matter).

After quite a lot of work and learn (i 'm not exactly an expert on php or html, to be truth i've learn with u and some tutorials recently, hehe) i make it works!

Yet, it seams there is something wrong (i'm using mybb 1.2.9). I have had to comment the “ require ('./global.php') ” line to make the login form appear, because if i uncomment it, the entire forum replaces my homepage.

Further, if i comment that line(the “require” one, yes) everything seams to work, but doesn't because if any of my registered users, login succesfuly, after login redirection the page “forget” the user is logged and doesn't show the famos “"Hey! ".$mybb->user['username'].".<br> Thanksyou for login in!” message.

Moreover, if i go to the forum index page(after login throught the main page) the forum recognise me as a logged user, but it doesn't let me logout (unless i log as administrator).it has non-sense!

Clearly, i'm not able to see something that is obvious, but it's making me crazy!
I would truly, truly thanks any kind of help.

Once again, thanks for any help anyone could give me, hope not to trouble too much Big Grin

Zeroena.

Please ho mighty gods of the mybb forum answer my pray Toungue

Last Edit: code out!
Well, my forum was set to "close" for mantainence, so it was logical this to happend.
Almos everything works all right now. Hope not to toubled you too much.

New issue:
can't logout now Confused what "blickety" wrote on page 3 seams not to work... well i'lll see what i do.

Salutes, Zeoena.
I tested it and all work Smile
Thanks
I finaly used the "link" solution kindly provided by mybb developers Big Grin

Thanks.
I get this error ?

Direct initialization of this file is not allowed.

Please make sure IN_MYBB is defined.
I got the error that crsoft got. This didn't fix...
if(!defined("IN_MYBB")) {
    die("This file cannot be accessed directly.");
}
What do I need to do?

EDIT: Ok I got that thing working but this comes up
This file cannot be accessed directly.
xScopex Wrote:I got the error that crsoft got. This didn't fix...
if(!defined("IN_MYBB")) {
    die("This file cannot be accessed directly.");
}
What do I need to do?

EDIT: Ok I got that thing working but this comes up
This file cannot be accessed directly.

xScopex Wrote:I got the error that crsoft got. This didn't fix...
if(!defined("IN_MYBB")) {
    die("This file cannot be accessed directly.");
}
What do I need to do?

EDIT: Ok I got that thing working but this comes up
This file cannot be accessed directly.

You have to have
define("IN_MYBB", 1);

Before both of these
chdir('forum'); // path to MyBB
include './global.php';
What if you already have a login system for your website?

Is there a code snippet I can place in my login class to log me into my forums, i.e. checking a previous session and creating a new one if neccessary? Ultimately I need a class that does both logins and can be called from either the website or the forum.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48