Version: 2.00, by Billspaintball
Developer Last Online: Nov 2011
Category: Integration with vBulletin -
Version: 3.7.0 RC 1
Rating:
Released: 03-20-2008
Last Update: Never
Installs: 100
Re-useable Code Additional Files Translations
No support by the author.
Hack Description
This is a cut down version of the user authentication and access control system I use on the non vB pages on my website.
This uses the vB 3.7 login system to log you in and out. It allows you to move between your forums and other pages on your site while remaining logged in.
It allows you to do things such as restrict pages by usergroup, display different content depending on a user being logged in or not.
For example, you can have banner Adds displaying to non members only, and/or let members access to specific content.
Ive cut it down to the bare minimum that it needs to work, no fancy stuff such as avatars, PM's, or even formating.
I will try and offer support, but work and family commitments mean I don't have much free time.
This code is a mix of my own, and pieces I have used from other hacks that are floating around.
This script has been confirmed as working on
vB 3.7 RC1
Change log
Version 2.00 (21st March 2008)
Initial vB 3.7.x release
Click on Install
If you have this script installed then please click on the install link because;
You will get notified if any security issues are reported.
You will get notified when there are any upgrades to this script
It gives me a warm fuzzy feeling and motivates me to develop more
Donations
First of all, to be clear. This script is 100% free.
We've just start re-coding our main website and one of the things on our wishlist was to integrate the vb login sequence and have vb help determine what 'non-registered' users can or can't do. Easy to use, easy to install and works like a charm. It has also encouraged me to look further into this and see what else is possible. Excellent work and thank you for this simple but very effective mod. :up:
thanks for that headsup Bill. I was about to come ask that. I've come to rely on this script a bit over the years (actually, an older version I think) and wanted to make sure it'd still work with the upgrade.
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!
<?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:
So a quick question regarding user authentication as I got this working really well now - at the moment it is checking for user ID "6" which is admin - non admins are moved to the site frontpage and information isnt loaded - however what I would like to do is have multiple usergroups able to access the page - ie 6,12,13 - would I then just change the code to
Does any one know if I can use this mod on my site if the forums is in a subdomain? when I add: require_once('/path/to/your/forums/global.php'); the page goes blank.
Does any one know if I can use this mod on my site if the forums is in a subdomain? when I add: require_once('/path/to/your/forums/global.php'); the page goes blank.
/path/to/your/forums needs to be the actual path to your forum root.
if you need:
Open up a text editor and paste this in it:
PHP Code:
<?
echo getcwd();
?>
and name the file path.php
make sure it's path.php and not path.php.txt or anything like that.
Upload that file to your forum root and point your browser to it.
example: http://yourforum.org/forum/path.php
should show you what you need to replace /path/to/your/forums with. delete that file when you're done with it.
Hope this helps.
Just a brief heads up for anyone who is interested, initial testing shows that this works with vB4 beta 3
Great but is there a fix for this cookies problem that everyone is having. I used this hack before and never had it do this before so it must be something to do with vb 3.8.4.