So basically I would like to turn this:
[img=360x184]http://i.imgur.com/alVlG5F.png[/img]
into something like this:
[img=360x184]http://i.imgur.com/smr11HI.png[/img]
I know the basics of PHP and Template editing, but I'm not sure where even to start with this. Should I make a new PHP file and redirect there? Or modifying the existing one?
Ok, so I read some things online and it seems what I want to do has been done, but there isn't really any documentation on it.
So, if this process is correct I need to first create a custom page using this guide: http://community.mybb.com/thread-6190.html
Then, since this file will be in the same directory as the forum, I need to follow this guide: http://community.mybb.com/thread-118512.html , in order to make sure that when users visit "index.php" they are redirected to my custom php page. (I would like to have it so that the PHP Page loads first, but I can figure that out later.)
I thought about renaming the "index.php" to something else so that I could have this customised login script as "index.php" and have it redirect to the renamed "index.php". (Using http://community.mybb.com/thread-69040.html) But, on second thought, that doesn't seem like a very good idea.
So, I will proceed to try to use the things outlined in these guides above. I'll use this thread for any bugs, support, and things like that. If you have anything that would help it would be greatly appreciated!
EDIT 2: So I tried using this code here to create a custom page:
But it just shows the default mybb login page. So, I'm going to now search for how to implement just the form. Without "member.php" including the whole forum into just its login form.
EDIT 3: Removing "{$header}" & "{$footer}" from "Template -> Member Templates -> member_login" does nothing.
Where is the code that displays the header and footer for the login page? Is it hard-coded in "member.php"?
[/spoiler]
EDIT Before Sleep: So I searched practically all the templates. Nada. The only that leaves me with is that it's hardcoded into "member.php". Removing it will be a daunting task. So, going to rest my head. Hopefully someone replies tomorrow morning!
It seems, I've reached the word limit for one post! So, Basically, as I'm typing this out for the third time before realizing. The TL;DR.
If the user is logged in, the login page displays this: (http://i.imgur.com/YhTV0q4.png)
If the user is not logged in, the page shows the standard myBB default login. Which is not what I want. Is there a way to disable the default login page on certain pages in php? Will update upon successful progress!
[img=360x184]http://i.imgur.com/alVlG5F.png[/img]
into something like this:
[img=360x184]http://i.imgur.com/smr11HI.png[/img]
PART 1
I know the basics of PHP and Template editing, but I'm not sure where even to start with this. Should I make a new PHP file and redirect there? Or modifying the existing one?
Ok, so I read some things online and it seems what I want to do has been done, but there isn't really any documentation on it.
So, if this process is correct I need to first create a custom page using this guide: http://community.mybb.com/thread-6190.html
Then, since this file will be in the same directory as the forum, I need to follow this guide: http://community.mybb.com/thread-118512.html , in order to make sure that when users visit "index.php" they are redirected to my custom php page. (I would like to have it so that the PHP Page loads first, but I can figure that out later.)
I thought about renaming the "index.php" to something else so that I could have this customised login script as "index.php" and have it redirect to the renamed "index.php". (Using http://community.mybb.com/thread-69040.html) But, on second thought, that doesn't seem like a very good idea.
So, I will proceed to try to use the things outlined in these guides above. I'll use this thread for any bugs, support, and things like that. If you have anything that would help it would be greatly appreciated!
EDIT 2: So I tried using this code here to create a custom page:
PHP:
<?php
chdir('.'); // path to MyBB
define("IN_MYBB", 1);
require './global.php';
?>
<?php
if($mybb->user['uid'])
{
// The user is logged in, say Hi
echo "Hey, $mybbuser[username].<br>
Thanks for logging in.";
}
else
{
// The user is not logged in, Display the form
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>";
}
?>
But it just shows the default mybb login page. So, I'm going to now search for how to implement just the form. Without "member.php" including the whole forum into just its login form.
EDIT 3: Removing "{$header}" & "{$footer}" from "Template -> Member Templates -> member_login" does nothing.
PHP:
<html>
<head>
<title>{$mybb->settings['bbname']} - {$lang->login}</title>
{$headerinclude}
</head>
<body>
<br />
{$inline_errors}
{$member_loggedin_notice}
<form action="member.php" method="post">
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead" colspan="2"><strong>{$lang->login}</strong></td>
</tr>
<tr>
<td class="trow1"><strong>{$lang->username}</strong></td>
<td class="trow1"><input type="text" class="textbox" name="username" size="25" style="width: 200px;" value="{$username}" /></td>
</tr>
<tr>
<td class="trow2"><strong>{$lang->password}</strong><br /><span class="smalltext">{$lang->pw_note}</span></td>
<td class="trow2"><input type="password" class="textbox" name="password" size="25" style="width: 200px;" value="{$password}" /> (<a href="member.php?action=lostpw">{$lang->lostpw_note}</a>)</td>
</tr>
<tr>
<td class="trow1" colspan="2" align="center"><label title="{$lang->remember_me_desc}"><input type="checkbox" class="checkbox" name="remember" checked="checked" value="yes" /> {$lang->remember_me}</label></td>
</tr>
{$captcha}
</table>
<br />
<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}" />
</form>
</body>
</html>
Where is the code that displays the header and footer for the login page? Is it hard-coded in "member.php"?
[/spoiler]
EDIT Before Sleep: So I searched practically all the templates. Nada. The only that leaves me with is that it's hardcoded into "member.php". Removing it will be a daunting task. So, going to rest my head. Hopefully someone replies tomorrow morning!
Part 2
Alright, so I woke up this morning and did some more digging around. It seems I needed to create my own template as a part of the theme and make a php file similar to this in "login.php":
PHP:
<?php
define('IN_MYBB', 1); require "./global.php";
//Check if the user is logged in
if(!$mybb->user['uid'])
{
//Redirect to Home Directory/index page
redirect("index.php", $lang->redirect_loggedin);
}
else
{
eval("\$html = \"".$templates->get("login_splash")."\";");
output_page($html);
}
?>
It seems, I've reached the word limit for one post! So, Basically, as I'm typing this out for the third time before realizing. The TL;DR.
If the user is logged in, the login page displays this: (http://i.imgur.com/YhTV0q4.png)
If the user is not logged in, the page shows the standard myBB default login. Which is not what I want. Is there a way to disable the default login page on certain pages in php? Will update upon successful progress!