same here. that is what happens to me.
I did all of the steps properly, and I seem to have a problem similar to many here.
When I log in, it has me logged in on the forums, but not the site. I tried echoing the variables of the user in different ways as well:
echo 'Worked: '.$mybb->user['username'];
echo 'Worked: '.$mybbuser['username'];
echo 'Worked: '.$user['username'];
Unfortunately, they all returned an empty string(besides 'Worked: '). Does anyone have an idea of why this is happening?
EDIT: I have MyBB 1.2.2 I believe. Could that change something?
So in order that we all not get mixed up... i will unite all the other codes so you all should use from now one this new code which i have coded and tested and proved to be working.
<?php
$level = "forums";// Name of MyBB dir
$redirect = "../thisfile.php";//Keep the ../ change thisfile to the name of this file
define('IN_MYBB', 1);
chdir($level);
require("global.php");//don't change.
if($mybb->user['uid'] > 0)
{
echo "Welcome back ".$mybb->user['username'];
}
else
{
echo "<form action='$level/member.php' method='post'>";
echo "Username: <input type='text' name='username' size='25' maxlength='30' /><br />";
echo "Password: <input type='password' name='password' size='25' />";
echo "<input type='hidden' name='action' value='do_login'>";
echo "<input type='hidden' name='url' value='$redirect' />";
echo "<input type='submit' class='submit' name='submit' value='Login' /></form><br>";
}
?>
you don't have to edit anything but those 2 variable at the top of the file.
Try this and tell me if it works.
If it doesn't please include your codes with your replies.
When I try this I get this error:
Fatal error: Cannot redeclare get_attachment_icon() (previously declared in /home/animal/public_html/wp-includes/post-template.php:379) in /home/animal/public_html/forum/inc/functions.php on line 1922
what did you add to the code?
Nothing, I just used this:
<?php
chdir('forum'); // path to MyBB
define('IN_MYBB', 1);
require './global.php';
?>
(I put that at the very top of a file named "Header.php" which of course controls the top and what not. I've also placed it where I wanted the login box to show up and same results.)
I used the code you supplied Mibb and when i log it it just shows the log in page and it doesnt say that i am logged in.
Animal24 Wrote:Nothing, I just used this:
<?php
chdir('forum'); // path to MyBB
define('IN_MYBB', 1);
require './global.php';
?>
(I put that at the very top of a file named "Header.php" which of course controls the top and what not. I've also placed it where I wanted the login box to show up and same results.)
Okay i understand but those have something other than this code in them isnt?
blubox Wrote:I used the code you supplied Mibb and when i log it it just shows the log in page and it doesnt say that i am logged in.
Can you try with the last code i have supplied please?
Ya. That is the code that I am using.
@zaher1988
What do you mean? Do you want me to post all the code that is located in that file here?