Big Thanks Jafo for the great great plugin !!!
OK, I saw lot's of posts asking for login/logout/avatar etc for wordpress and I needed the same and couldn't find one and so I coded one with my limited php knowledge here it is for you guys...
Credits:
Basically, this is a simpler version of this plugin:
Name: Deluxe vB User login and access control on non vB pages
URL:
https://vborg.vbsupport.ru/showthread.php?t=173698
I do not wish to take any credits from the original author - Billspaintball and all credits go to Billspaintball.
Code:
Code:
<div>
<?php
global $vbulletin,$vbphrase,$pmbox,$reply,$db;
$forumurl = get_option('vbb_VBURL');//forumurl should not have a trailing slash e.g. http://www.mysite.com/forum
if (!$vbulletin->userinfo['userid']) { ?>
<form action="<?php echo $forumurl; ?>/login.php?do=login" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, $show[nopasswordempty])">
<input type="hidden" name="do" value="login" />
<input type="hidden" name="url" value="/" />
<input type="hidden" name="vb_login_md5password" />
<input type="hidden" name="vb_login_md5password_utf" />
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="cookieuser" value="1" id="cb_cookieuser" tabindex="1" />
<label>Username: <input name="vb_login_username" type="text" id="login" tabindex="1" class="bginput" accesskey="u"/></label><br>
<label>Password: <input name="vb_login_password" type="password" id="password" tabindex="1" class="bginput" /></label><br>
<input name="submit" type="submit" id="submit" tabindex="1" value="Login" accesskey="s" class="button" />
</form>
<?php
// Display text and link to register and lost password.
echo "<br /><a href=\"".$forumurl."/register.php?s=$session[sessionhash]\" target=\"_parent\"><b>Register Now</b></a>";
echo " | ";
echo "<a href=\"".$forumurl."/login.php?do=lostpw\" target=\"_parent\"><b>Forgot Password</b></a>";
}else{
echo "Welcome Back, <b>";
echo "<a href=\"$forumurl/member.php?u=";
echo $vbulletin->userinfo['userid'];
echo "\">";
echo $vbulletin->userinfo['username'];
echo "</a><br />";
?>
<img src="<?php echo $forumurl; ?>/image.php?u=<?php echo $vbulletin->userinfo['userid'] ?>&dateline=<?php echo TIMENOW ?>" alt="<?php echo $reply['username'] ?>'s Avatar" class="avatar avatar-32 photo avatar-default" width="150" height="150" />
<?php
echo "<br />";
//display logout link
echo "<a href=\"$forumurl/login.php?$session[sessionurl]do=logout&logouthash=$logouthash";
echo $vbulletin->userinfo['logouthash'];
echo "\">";
echo "<font size=\"1\" face=\"verdana\">Log Out</font></a><br />";
// Display last visit time and date
echo "You last visited: $pmbox[lastvisitdate] at $pmbox[lastvisittime]";
echo "<br />";
// Display PM Details and generate link to PM box
echo "<a href=\"$forumurl/private.php?$session[sessionurl] \">Private Messages: </a> $vbphrase[unread_x_nav_compiled] $vbphrase[total_x_nav_compiled]";
echo "<br />";
} ?>
</div>
Installation:
Just copy-paste that code into your template where you would like to display the login/logout/register box. Style it as per your theme.
Note: The forumurl which you configured while installing vbbridge should not have a trailing slash e.g.
http://www.mysite.com/forum.In case it does, then remove / from the code after each $forumurl occurence.
Screenshot:
To Do:
Presently after logout, it redirects to the forum logout screen. It would be nice to redirect the user back to the same page.
Other:
You can check the original plugin and also add some more advanced features to the login box e.g. new posts since last login.