MyBB Community Forums

Full Version: Integrating MyBB into your site: How?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everybody,

First of all I am sorry if this thread is posted on the wrong board, but I didn't know where to post it.

I recently started to code a website and wanted to integrate MyBB to it, I searched for tutorials but only found this one, which seems dead. So I was wondering if somebody can help me a bit.

I want to use MyBB specific variables within my website, such as:
$mybbuser[username]

I tried as it is shown in the tutorial but failed since I have:
my text, {1} which is supposed to show $mybbuser[username] and then the rest of my text.

Can somebody please help me?
Thank you in advance.
Have you tried that tutorial?? It may be dead but from what I've heard it still works fine.
Hello,
Thank you for your answer, however it seems that you didnt' read my post completely:
Quote:I tried as it is shown in the tutorial but failed since I have:
my text, {1} which is supposed to show $mybbuser[username] and then the rest of my text.

Yours
What's the code you're using?
Before any kind of of display and even before HTML I have:

<?php
chdir('mybb'); // path to MyBB
define("IN_MYBB", 1);
require './global.php';
?>

Then I added a login form:
<?php

if($mybb->user['uid'] > 0)
{
echo "Hello and weclome, $mybbuser[username].<br>
Thank you for logging in.";
}
else
{
echo "<form action='forums/member.php' method='post'>
Username: <input type='text' name='username' size='25' maxlength='30' /><br />
Password: <input type='password' name='password' size='25' />
<input type='hidden' name='action' value='do_login'>
<input type='hidden' name='url' value='index.php' />
<input type='submit' class='submit' name='submit' value='Login' /></form><br>";
}
?>
You may want to try {$mybb->user['username']}

so

// other stuff
echo "Hello and weclome, {$mybb->user['username']}.<br>
Thank you for logging in.";
// other stuff
Thanks! Will try! Smile
It does't parse it correctly, I mean it shows this:

Quote:Hello and welcome, (Username is supposed to be here but it isn't).
Thank you for logging in.

Maybe I did something wrong in the inclusion of Global.php?
I have my forum in http://localhost/mybb/

Thanks a lot for help!
And you are logged in?
Yes I am logged in on the forum.
Any Ideas on how to fix it?

Thank you in advance for help.
Can somebody help me please?