Quote:
Originally Posted by MadsK
I found the trick to make it happen.
Below is the code i use for my site. It has been altered a little with some extra links after you've logged in but they can be changed. I've tested it with a couple of different friends on different computers, operating systems and browsers and it works on all of them.
With that said this is only working with Wordpress as it collects the cookie from the wordpress database and outputs it. When logging out it also clears both wordpress and vbulletin cookie!
I would really like some feedback on it
You can see it in action on my website http://www.swtorcommunity.com
Code:
<?php
// Version 2.00
// Released March 21st, 2008
// For vB 3.7.x
// Edit the line below to show path to your forums
$forumpath = "/forum/";
// You dont have to edit anything underneath here,
// but you can if you wish to style the login box
// to match the style of your site.
// ---------------
// COPYRIGHT STUFF
// ---------------
// You are free to use and modify this script in anyway you like.
// However,
// - Do not remove copyright notice
// - Dont pass it off as your own work.
//
// This script is provided free of charges, however If you use this on a commercial
// venture a small paypal donation to cwp@cwp.id.au would be apprecieated.
// We check if user is logged in
if (isset($user_ID)) {
// User is logged in
echo "<div id=loginwelcome>";
$user_info = get_userdata($user_ID);
echo $before_widget . $before_title . __("Welcome "). $user_info->display_name . $after_title;
echo "</div>";
// If logged in display logout link
echo "<br />";
echo "<div id=loginmeta>";
echo "<a href=\"".$forumpath."usercp.php";
echo "\">";
echo "User CP</a>";
echo "<a href=\"".$forumpath."private.php";
echo "\">";
echo "Private Messages</a>";
echo "<a href=\"".$forumpath."search.php";
echo "\">";
echo "Search</a>";
echo "<a href=\"/wp-login.php?action=logout\">Logout</a>";
echo "</div>";
} else { // If user is not logged in, we do this stuff
// Display login boxes + button
// You can style this with html or CSS as normal if desired.
echo"
<form id=loginform action=\"".$forumpath."login.php\" method=post onsubmit=md5hash(vb_login_password,vb_login_md5password,vb_login_md5password_utf)>
<script type=text/javascript src=\"".$forumpath."clientscript/vbulletin_md5.js\"></script>
<input name=vb_login_username value=Username id=user onFocus=this.value='' type=text id=navbar_username size=10 />
<input name=vb_login_password type=password id=password size=10 value=Password onFocus=this.value='' />
<br />
<label id=rememberme for=cb_cookieuser_navbar>Remember Me?<input name=cookieuser type=checkbox id=cb_cookieuser_navbar value=1 checked=checked />
</label>
<input type=submit id=submit value=Login title=$vbphrase[enter_username_to_login_or_register] value=\"Log In\" />
<input type=hidden name=s value=$session[sessionhash] />
<input type=hidden name=do value=login />
<input type=hidden name=vb_login_md5password />
<input type=hidden name=vb_login_md5password_utf />
</form>
";
}
?>
|
You are a champion!!!!
I have been looking everywhere for a Wordpress login.
You made my day!
How can I display some user info ie: user photo/thread count/new messages like this mod:
https://vborg.vbsupport.ru/showthread.php?t=173698
Thanks again and hope you can help out
Andy