Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.7 > vBulletin 3.7 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Deluxe vB User login and access control on non vB pages Details »»
Deluxe vB User login and access control on non vB pages
Version: 3.00, by Billspaintball Billspaintball is offline
Developer Last Online: Nov 2011 Show Printable Version Email this Page

Category: Integration with vBulletin - Version: 3.7.0 RC 1 Rating:
Released: 03-20-2008 Last Update: Never Installs: 115
Re-useable Code Additional Files Translations  
No support by the author.

Hack Description

This is the deluxe version of the user authentication and access control system I use on the non vB pages on my website.
For the simple no frills version [URL=https://vborg.vbsupport.ru/showthread.php?t=173693look here.[/URL]

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 displying to non members only, and/or let members access to specific content.

It also displays the logged in users Avatar, number of unread PM's, New posts since last visit, total posts and total threads.
It also allows you to specify a maximum Avatar size, and resize any avatars larger than that, while keeping their height/width ratios in proportion!
Its very handy if you allow large avatars, but want a small format display on your non forum pages.

If the user is not logged in, a login box is displayed, along with total posts and total threads in the forums.

I will try and offer support, but work and family commitments mean I dont 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

Known Bugs
Will not display Avatars correctly if they are kept in the file system (database avatars are fine)

Change log

Version 3.00 (21st March 2008)
  • Initial release for vB 3.7.x


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.

However if you feel an urge to donate I'm not going to say no.
Donations can be made at http://www.billspaintball.com/vb3/bd_donate.php

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #22  
Old 03-25-2008, 02:48 PM
txsbmw txsbmw is offline
 
Join Date: May 2006
Posts: 238
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anyone know how to make this code validate with:
http://validator.w3.org/
under XHTML 1.0 Transitional?

Almost all of my errors are coming from this one mod on my non vb pages.
Reply With Quote
  #23  
Old 04-01-2008, 03:47 PM
davide101 davide101 is offline
 
Join Date: Dec 2005
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have two tips for anyone using this system.

First, it's to change the wording of the private messages phrase to anything you want. I have it set to say "Private messages, "1 new message", and "2 new messages". Here's the code for that (it goes in the include):

Code:
// Display PM Details and generate link to PM box
$pmremove = array("Unread ", "<strong>", "</strong>");
$unreadPM = str_replace($pmremove,"",$vbphrase[unread_x_nav_compiled]);
if ($unreadPM==1) { 
	echo "<a id=\"unreadpm\" href=\"".$forumpath."private.php?$session[sessionurl] \">1 new message</a>";
} else {
	if ($unreadPM>1) {
	echo "<a id=\"unreadpm\" href=\"".$forumpath."private.php?$session[sessionurl] \">" . $unreadPM . " new messages";
  } else {
    echo "<a href=\"".$forumpath."private.php?$session[sessionurl] \">Private Messages</a>";  
	}
}
Similarly, it's easy to show new posts with the proper grammatical syntax. In other words, have it say 'No new posts' '1 new post' or '2 new posts'.

Code:
// finds number of new posts
$newposts = $db->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "post AS post " . iif($vbulletin->options['threadmarking'], 'LEFT JOIN ' . TABLE_PREFIX . 'threadread AS threadread ON (threadread.threadid = post.threadid AND threadread.userid = ' . $vbulletin->userinfo['userid'] . ')') . " WHERE dateline >= " . $vbulletin->userinfo['lastvisit'] . iif($vbulletin->options['threadmarking'], ' AND dateline > IF(threadread.readtime IS NULL, ' . (TIMENOW - ($vbulletin->options['markinglimit'] * 86400)) . ', threadread.readtime)'));
$newposts = vb_number_format($newposts['count']);

if ($newposts < 1) {
echo "<a href=\"".$forumpath."search.php?$session[sessionurl]do=getnew\">No new posts</a><br />";}

if ($newposts == 1) {
echo "<a href=\"".$forumpath."search.php?$session[sessionurl]do=getnew\">$newposts new post</a><br />";}

if ($newposts > 1) {
echo "<a href=\"".$forumpath."search.php?$session[sessionurl]do=getnew\">$newposts new posts</a><br />";}
Hope this helps someone. It took me a little bit of tinkering to get it just right.
Reply With Quote
  #24  
Old 04-04-2008, 12:03 PM
Triky's Avatar
Triky Triky is offline
 
Join Date: Mar 2007
Location: [Italy]
Posts: 728
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I can't get it work.

Quote:
Notice: Undefined index: HTTPS in c:\programmi\easyphp1-8\www\vbtest\includes\class_core.php on line 1643

Notice: Undefined index: HTTPS in c:\programmi\easyphp1-8\www\vbtest\includes\class_core.php on line 1643

Notice: Undefined index: HTTP_REFERER in c:\programmi\easyphp1-8\www\vbtest\includes\class_core.php on line 1670




Unable to add cookies, header already sent.
File: c:\programmi\easyphp1-8\www\vbtest\includes\class_core.php
Line: 1643


Reply With Quote
  #25  
Old 04-10-2008, 08:30 PM
davide101 davide101 is offline
 
Join Date: Dec 2005
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Does anyone know how to access the profile url? It's not located in $vbulletin->userinfo and I'm sure where else to look. I'd like to link the avatar there.
Reply With Quote
  #26  
Old 04-27-2008, 05:39 AM
Billspaintball's Avatar
Billspaintball Billspaintball is offline
 
Join Date: Sep 2003
Location: Bathurst, Au
Posts: 649
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by davide101 View Post
I have two tips for anyone using this system.

First, it's to change the wording of the private messages phrase to anything you want. I have it set to say "Private messages, "1 new message", and "2 new messages". Here's the code for that (it goes in the include):

Hope this helps someone. It took me a little bit of tinkering to get it just right.
Thanks,
I will update the next version with those improvements.
Reply With Quote
  #27  
Old 04-27-2008, 05:40 AM
Billspaintball's Avatar
Billspaintball Billspaintball is offline
 
Join Date: Sep 2003
Location: Bathurst, Au
Posts: 649
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Triky View Post
I can't get it work.
See item 1 in the troubleshooting guide.
https://vborg.vbsupport.ru/showpost....23&postcount=2
Reply With Quote
  #28  
Old 04-30-2008, 04:51 AM
Ryan Ashbrook's Avatar
Ryan Ashbrook Ryan Ashbrook is offline
 
Join Date: Dec 2002
Location: Cincinnati, Ohio
Posts: 422
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I got file based avatars to work.

In the login_inc.php file find:

PHP Code:
$file $forumpath "image.php?u=$userid"
And replace it with:

PHP Code:
    if ( $vbulletin->options['usefileavatar'] == )
    {
        if ( 
$vbulletin->userinfo['avatarid'] == )
        {
            
$file $forumpath $vbulletin->options['avatarurl'] . "/avatar" $userid "_" $vbulletin->userinfo['avatarrevision'] . ".gif";
        }
        else
        {
             
// Unfortunately, need to query the database for the avatar, will work on array caching all avatars later.
             
$query $db->query_first "SELECT * FROM " TABLE_PREFIX "avatar WHERE avatarid = " $vbulletin->userinfo['avatarid'] . " ; " );
             
$avatar $db->fetch_array $query );
            
$file $forumpath $avatar['avatarpath'];
        }
    }
    else
    {
        
$file $forumpath "image.php?u=" $userid;
    } 
Individual users may need to tweak the avatar paths based on their settings, however this will probably work for most.
Reply With Quote
  #29  
Old 04-30-2008, 04:55 AM
Ryan Ashbrook's Avatar
Ryan Ashbrook Ryan Ashbrook is offline
 
Join Date: Dec 2002
Location: Cincinnati, Ohio
Posts: 422
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by davide101 View Post
Does anyone know how to access the profile url? It's not located in $vbulletin->userinfo and I'm sure where else to look. I'd like to link the avatar there.
Use this:

PHP Code:
echo ( "<a href=\"" $forumpath "member.php?u=" $vbulletin->userinfo['userid'] . "\">avatar image code here</a>" ); 
Reply With Quote
  #30  
Old 04-30-2008, 05:22 AM
Javi_gray Javi_gray is offline
 
Join Date: May 2007
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What would I do if I wanted it to show friend requests in addition to private messaging?
Reply With Quote
  #31  
Old 04-30-2008, 05:54 AM
Ryan Ashbrook's Avatar
Ryan Ashbrook Ryan Ashbrook is offline
 
Join Date: Dec 2002
Location: Cincinnati, Ohio
Posts: 422
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Javi_gray View Post
What would I do if I wanted it to show friend requests in addition to private messaging?
Add this:

PHP Code:
echo ( "You currently have <a href=\"" $forumpath "profile.php?do=buddylist\">" vb_number_format $vbulletin->userinfo['friendreqcount'] ) . "</a> friendship requests." ); 
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:27 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04956 seconds
  • Memory Usage 2,341KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (4)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete