Not Solved [How To?] Force users to login Template
#1
Not Solved
I have "Force Users to Login" set in the admin panel.

If someone new arrives to the forum it currently it shows the default message "You are either not logged in or do not have permission to view this page. This could be because one of the following reasons:"

This message is within the forums style.. 

Here an example of what im trying to achieve.

https://redacted.ch/

What page and or files do I need to edit, to show a login screen like the above website upon reaching the site.. without the standard forum showing??
Reply
#2
Not Solved
BUMP?

out of 900 views.. not one has any idea how I could achieve this??
Reply
#3
Not Solved
Hi,

I didn't try it, but if I would like something like you want, I'll try to change the code of this 2 files:

global.php - lines 1134-1139
if($mybb->settings['forcelogin'] == 1 && $mybb->user['uid'] == 0 && !in_array($current_page, $force_bypass) && (!is_array($force_bypass[$current_page]) || !in_array($mybb->get_input('action'), $force_bypass[$current_page])))
{
	// Show error
	error_no_permission();
	exit;
}

archive/global.php - lines 204-210
if($mybb->settings['forcelogin'] == 1)
{
	if($mybb->user['uid'] == 0)
	{
		archive_error($lang->error_mustlogin);
	}
}

And I'll change the error to something like a redirection to a self-made login template or directly to https://YOURFORUM_URL/member.php?action=login
I don't answer questions about localhost forums or forums without URL, I'm not a seer.  Cool
Reply
#4
Not Solved
thanks for this.. It has led me to create index2.php
I have changed the "error_no_permission" template in the admin area to

window.location.replace("index2.php");


index2.php code below
<form action="member.php" method="post">
<input type="text" name="username" value="" />
<input type="password" name="password" value="" />
<input type="submit" name="submit" value="Login" />
<input type="hidden" name="action" value="do_login" />
</form>

However, when trying to login on index2.php it MyBB forum gives me this error:
Authorization code mismatch. Are you accessing this function correctly? Please go back and try again.

Any ideas how I can get index2.php to have an auth code?!
Reply
#5
Not Solved
You need to add the following hidden input to your login form:
<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />

[ExiTuS]
MyBB Forum + innovative full-responsive Theme
Live-Escape-Game-Forum
Reply
#6
Not Solved
I have done this, and still showing the Authorization code mismatch

<form action="member.php" method="post">
<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
<input type="text" name="username" value="" />
<input type="password" name="password" value="" />
<input type="submit" name="submit" value="Login" />
<input type="hidden" name="action" value="do_login" />
</form>

Reply
#7
Not Solved
Hi,

maybe you have to check the member_login template. Make a raw copy to your index2.php and see if it works. After that you could change the HTML to whatever you may need.
I don't answer questions about localhost forums or forums without URL, I'm not a seer.  Cool
Reply
#8
Not Solved
I was able to fix this error.. by putting default back in error_no_permission template

Installing Hooks plugin and creating 2 hooks for custom no permission Big Grin

Works great!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)