MyBB Community Forums

Full Version: Integrating MyBB into your website. (Login Form)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This is very nit-picky, but remember to use "<br />" and not "<br>".

XHTML compatibility <3 Anyways, great tutorials! I'm actually going to work this into my site now.
Cool thanks
But is there anyway to change the message from

"Hey, ....
Thanks for logging in."

to just a "Log Out" link?
I'm having problems with this mod and I think it's cookies but I dunno. My main site is at www.blakemiller.org and then my forum is at www.blakemiller.org/mybb/
The problem is when I try to login on the main site it logs me in on the forum but when I go back to the main site I am still loged out. Any help?
Hi,

I'm working on a portal-system integrated with MyBB. This post has helped me a lot already, thanks! But, I'd like to know if there is a way to let a user log out, through a link, and then return to the current page (like one would do with the aforementioned login-form). Furthermore, it'd be nice to have a full documentation on how MyBB works, to, for instance, get to know what classes, properties and methods are useable to those who want to integrate MyBB.

Anyhow, great software!
Greetings,

Ace
^_^ aha, simple shiz, lurve it nods ^__^
very good idea, but then its just down to skinning the website to match the forum, or forum to teh skin Smile
Ace-Someone Wrote:....But, I'd like to know if there is a way to let a user log out, through a link, and then return to the current page (like one would do with the aforementioned login-form)....

I just did what you are talking about on my site. I am not sure if there is another way, but I had to edit the members.php file.

Inside:
else if($mybb->input['action'] == "logout")
Where it says:
redirect("index.php", $lang->redirect_loggedout);
I replaced it with:
if($mybb->input['url'])
	{
	     redirect($mybb->input['url'], "You have successfully been logged out.<br>You will now be taken back to the main page");
	}
	else
	{
		redirect("index.php", $lang->redirect_loggedout);
	}
I am really new to changing mybb, so I didn't worry about changing the language file... this seemed simpler IMO.

On the page where I put the logout form, I used the same basic strategy as the OP. So you really just have to make sure that you add the url input.

if($mybb->user['uid'])
{
  // The user is logged in, say Hi
echo "Welcome $mybbuser[username].<br>
<form action='mybb/member.php?uid=$mybbuser[uid]' method='post'>
<input type='hidden' name='action' value='logout'>
<input type='hidden' name='url' value='http://whereever.com/page.php' />
<input type='image' src='images/logout.gif' name='submit' value='Login' /></form><br>";}
Thanks a lot!
I want to show the protected pages only for special Usergroups. Can someone tell me how to do this.
You can use some code like the following:
if($mybb->user['usergroup'] = "x" || $mybb->user['usergroup'] = "y" || $mybb->user['usergroup'] = "z") {
    // User can access
} else {
    // User has no permission to view the page
}
Replace x, y and z with the Group-IDs of the usergroups that are allowed to view that page.
An simpler way..
PHP Code:
if($mybb->user['usergroup'] != "x" || $mybb->user['usergroup'] != "y" || $mybb->user['usergroup'] != "z") {
����// User has no permission to view the page, view nopermission page? nopermission();