Jump to content


MyBB Integration


  • You cannot reply to this topic
No replies to this topic

#1 jold101

    Young Padawan

  • Members
  • Pip
  • 48 posts
  • Gender:Male
  • Location:Somerset,UK
  • Interests:Creating websites with (x)HTML coding, PHP coding, CSS styling, AJAX and MySQL databases. Online gaming (Counter Strike etc.) and golf.

Posted 31 March 2007 - 04:08 PM

Hello, I want to integrate my site with MyBB. I have got the code to do it, but, for some odd reason it doesn't work...

It displays:

Hello Guest, Login/Register/Lost Password

and if you are logged in

Welcome back (username), Inbox (Number of unread messages), User CP, View New Posts, Logout.

But, when I log in, the text doesn't change, it still says Hello Guest.

I have included this at the top of my index.php

<?php
$rel = "./forums/"; // The directory to your forum--relative to this file's location; include ending slash
define("IN_MYBB", 1);
chdir($rel);
include "global.php";
?>

and this is the code I use to display those links:

<?php
if($mybb->user['uid'])
{
?>
Welcome, <a href="<?php echo $rel; ?>member.php?action=profile&amp;uid=<?php echo $mybb->user["uid"]; ?>"><? echo"<strong>".$mybb->user['username']."</strong>"?></a> | <? if($mybb->user['usergroup'] == 4)
{
$alink = "<a href='/forums/admin/index.php'>Forum CP</a> |";
}
echo $alink;?><? if($mybb->user['usergroup'] == 4)
{
$alink = "<a href='sitecp.php'>Site CP</a> |";
}
echo $alink;?> <a href="<?php echo $rel; ?>private.php">Inbox (<? echo"<strong>".$mybb->user['newpms']."</strong>"?>)</a> | <a href="<?php echo $rel; ?>search.php?action=getnew">View new posts</a> | <a href="<?php echo $rel; ?>usercp.php">Settings</a> | <a href="<?php echo $rel; ?>member.php?action=logout&amp;uid=<?php echo $mybb->user["uid"]; ?>">Logout</a>
<?php
}
else
{
?>
Hello Guest, <a href='<?php echo $rel; ?>member.php?action=login'>Sign In</a> - <a href='<?php echo $rel; ?>member.php?action=register'>Register</a>
- <a href='<?php echo $rel; ?>member.php?action=lostpw'>Forgot Password</a>
<?php
}
?>

It works fine when I use it on localhost. But when I use it online it doesn't work...





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users