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.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
How to add a 'logout' link?

Also, the $mybbuser[username] does not seem to be echoed out.

Quote:Hey, .
Thanks for logging in.
Faltzer Wrote:I thought this was integration, this is more like a Login form. Because after it logs in, it doesn't track the cookies on the site. Only on the forums. Is that even supposed to happen? Is it due to some myBB code change?

You need to have you cookie path set up so that it can be accessed from the location this form is. For example:
If you forum is at /forum/ but this form is at /, your cookie path must be / for the cookie to be accessible by the form.

silentkiller Wrote:How to add a 'logout' link?
// Get the users sid for their uid
$query = $db->simple_select(TABLE_PREFIX.'sessions', 'sid', "uid = '{$mybb->user['uid']}'");
$sid = $db->fetch_field($query, 'sid');
			
echo("<li><a href=\"YOUR-FORUM-PATH/member.php?action=logout&amp;uid={$mybb->user['uid']}&amp;sid={$sid}\">Logout</a></li>");
Hi,

How about $mybbuser[username] ?

It is not returning anything.
silentkiller Wrote:Hi,

How about $mybbuser[username] ?

It is not returning anything.

The code below does show the username.

I think the first post needs a couple of updates made

 echo $mybb->user["username"] 

Cheers...
Yeah. Anyway, when I log in it redirtects me to my forums. I don't want it to do that.

How do I stop that, so it just redirects you back to the index page saying "Thanks for logging in"?

Thanks,

BP
Look for :

<input type='hidden' name='url' value='index.php'/>

and change it to something like

<input type='hidden' name='url' value='/index.php'/>
Thanks Smile

Now, I want to add a link on youe username to User CP. But I know how to this Smile

Thanks,

BP
blueparukia Wrote:Thanks Smile

Now, I want to add a link on youe username to User CP. But I know how to this Smile

Thanks,

BP

Here ya go

<a href="FORUM_DIRECTORY/usercp.php"><?php echo $mybb->user["username"]; ?></a>

Cheers Fishntassie...
blueparukia Wrote:But I know how to this

Thanks a lot anyway though. My log in box now consists of User CP, Admin CP (for admins) and Private message links Toungue

BP
blueparukia Wrote:
blueparukia Wrote:But I know how to this

Thanks a lot anyway though. My log in box now consists of User CP, Admin CP (for admins) and Private message links Toungue

BP

Is the code on page one still correct i dont get it t work at all.

- do i have to use the absolute path?
- and my forum is in een sub domain does that matter.

thank you already
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48