Hi all, I have an existing content site which is is based on the latest PHP code and a MYSQL database. It is similar to an article directory - users can login and submit articles, create a profile, rate, comment etc. If I install vBulletin, I would really like to integrate the login process. E.g. if they login to my site, they automatically get logged into the forum as well (which they will access from the home page). Is this easy/possible? I am worried about not having access to source code. How many hours would it take? Thanks in advance for all of your advice, Dave.
Is it possible? Yes. Is it easy? No. You might try looking at a few "bridges" that link Wordpress/Other CMS to vBulletin and going from their example. You can't estimate how many hours it would take, but I would suggest you outsource it if you are at all new to PHP/MySQL because this isn't going to be an easy task.
Ok, this is an easy way to do it yourself. Include a file that checks if the user is logged in <?php require_once (''.$_SERVER["DOCUMENT_ROOT"].'/your_include_directory/vblogin_inc.php'); ?> PHP: This is the file that does the check: vblogin_inc.php: <?php // Edit the line below to show path to your forums $forumpath = "http://www.blablabla.com/myforumdirectory/"; // Check if user is logged in if ($vbulletin->userinfo['userid']!=0) { // If Logged in display welcome back message echo "<p>Welcome back, <b>"; echo $vbulletin->userinfo['username']; echo " !</b> - "; // If logged in display logout link echo "<a href=\"".$forumpath."login.php?$session[sessionurl]do=logout&logouthash=$logouthash"; echo $vbulletin->userinfo['logouthash']; echo "\">"; echo "Log out</a></p>"; } 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. // Edit formaction to point to your forum loginpage echo(' <form id="rightlogin" action="/myforumdirectory/login.php?do=login" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)"> <script type=text/javascript src="'.$forumpath.'clientscript/vbulletin_md5.js"></script> <table border="0"><tr><td colspan="2" valign="bottom" style="height: 20px">Log in</td></tr> <tr><td valign="bottom">Username</td><td valign="bottom">Password</td></tr> <tr><td valign="bottom"><input type="text" name="vb_login_username"></td> <td valign="bottom"><input type="password" name="vb_login_password"> <input type="submit" value="Log in" /> <tr><td colspan="2"> <label for=cb_cookieuser_navbar><input name="cookieuser" type="checkbox" id="cb_cookieuser_navbar" value="1" checked="checked" /> Remember me </label> </td></tr></table> <input type="hidden" name="s" value="" /> <input type="hidden" name="do" value="login" /> <input type="hidden" name="vb_login_md5password" /> <input type="hidden" name="vb_login_md5password_utf" /> </form> '); } ?> PHP: What this file does is to check if the user is logged in or not. If the user has not logged in it shows a small login form. If a user is logged it shows a greeting with the username. Add the include statement to all php files that you want to perform check if the user is logged in or not. Put the include line where you want the login form/greeting to be displayed. That's it you're done. See an example of use here: http://alltomskolan.se
Yep, we implement a similar system on our site to integrate user/support/payment systems with our forums.