Not Solved [General] MyBB Login Issue (Integration w/Website)
#1
Not Solved
Objective:   MyBB Login integration with current website.
Code at top of page: 
<?php
chdir("MyForumPath/"); // path to MyBB
define("IN_MYBB", 1);
require("./global.php");
chdir("../");
?>



Body of Page:
<?php

if($mybb->user['uid'])
{
    // If the user if logged in, display a welcoming message.
    echo "Welcome back ".$mybb->user['username']."!<br />";
    echo "Thanks for logging in.";
}

else
{
	echo "Oops!";
}

?>

Return:  When not logged in, the page returns what appears on the "members.php" page instead of returning "Oops!".  When logged-in, the page appears as it should. 

The Issue is 2-fold:  

1.  Instead of showing "Oops!", the page automatically loads the "MyForumPath/member.php" content on the site index.php page.

2.  When I log-in using the modal "quick login" feature that appears in the header, the page works perfectly.  However, using the login form in the body does not work. 


In other words, the code in the "Header_Welcomeblock_Guest" template works:
<span class="welcome">{$lang->welcome_guest} <a href="{$mybb->settings['bburl']}/member.php?action=login" onclick="$('#quick_login').modal({ fadeDuration: 250, keepelement: true, zIndex: (typeof modal_zindex !== 'undefined' ? modal_zindex : 9999) }); return false;" class="login">{$lang->welcome_login}</a> <a href="{$mybb->settings['bburl']}/member.php?action=register" class="register">{$lang->welcome_register}</a></span>



The code in the "Member_Login" template code does not:
<div align="center"><input type="submit" class="button" name="submit" value="{$lang->login}" /></div>
<input type="hidden" name="action" value="do_login" />
<input type="hidden" name="url" value="{$redirect_url}" />


No doubt the login issue is because the content is loaded on a page that does not share the same file path as "member.php" (it is up one directory). 

Questions:
1.  Why does the above load the members.php content instead of my "Oops!" test message in the first place?
2.  MyBB is able to generate the content from members.php on my index.php page (up one directory) but logging in from that directory does not work.  If I changed the file paths on members.php, the log-in would no longer work when accessing the page from the correct directory so that is not a viable solution. What should I do?


Thanks in Advance!
Dex.

PS
I tried these instructions but it appears as though this information is out of date as my "Oops!" test shows that for whatever reason, MyBB overrides the code and automatically generates the content from the members.php page.

Also, please do not simply suggest that I replace the member_login code with the header_welcomeblock_guest code.  I already know that is an option, but it does not fix why it does not work in the first place.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)