View Single Post
  #695  
Old 07-19-2009, 03:22 PM
wicked80 wicked80 is offline
 
Join Date: Feb 2008
Posts: 53
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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'] ?>&amp;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&amp;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.
Attached Images
File Type: jpg loginplugin.JPG (16.1 KB, 0 views)
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01220 seconds
  • Memory Usage 1,802KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_attachment
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete