Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-25-2009, 09:11 PM
EddieVan EddieVan is offline
 
Join Date: Oct 2008
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Restrict access to HTML pages using vBulletins login/password

Is there a way to restrict users to access one or more web pages on a web site such that users must be logged into vBulletin to do so? We are actually currently using 3.7 and would like to do the change in 3.7, but we will be moving to 3.8, so I'd like to know the answer for both!

I have checked vBulletin.org and noticed there are some "hacks" that do this for 3.6 and earlier.

Ed
Reply With Quote
  #2  
Old 02-25-2009, 10:06 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

See either of these articles - How to create your own vBulletin-powered page! (uses vB templates) or [How-To] vBulletin API Basics: Creating Custom Pages & Misc. If you include global.php like those articles do, then you may do any sort of condition on the users id or group to restrict access.
Reply With Quote
  #3  
Old 02-25-2009, 11:08 PM
1Unreal 1Unreal is offline
 
Join Date: Jul 2008
Location: London
Posts: 372
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can password protect forums in vB by default. If you used that it would be much more streamlined and easier all round.
Reply With Quote
  #4  
Old 02-25-2009, 11:18 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't think he is asking about forums, though. I got the impression he was asking about custom pages.
Reply With Quote
  #5  
Old 02-25-2009, 11:21 PM
1Unreal 1Unreal is offline
 
Join Date: Jul 2008
Location: London
Posts: 372
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes but restricting a forum would be easier than a custom page. You would probably have to create a plugin to password protect a custom page. I don't think you could do it with just conditionals.
Reply With Quote
  #6  
Old 02-25-2009, 11:25 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by 1Unreal View Post
Yes but restricting a forum would be easier than a custom page. You would probably have to create a plugin to password protect a custom page. I don't think you could do it with just conditionals.
It's pretty easy actually:

PHP Code:
if (!isset($vbulletin->userinfo['userid']) OR $vbulletin->userinfo['userid'] == OR !is_member_of($vbulletin->userinfo,x,y,z))
{
    
print_no_permission();

That keeps out all unregistered users and also all users that are not a member of x,y, or z.
Reply With Quote
  #7  
Old 02-25-2009, 11:30 PM
1Unreal 1Unreal is offline
 
Join Date: Jul 2008
Location: London
Posts: 372
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hm...Ok. You win.
Reply With Quote
  #8  
Old 02-26-2009, 06:21 PM
EddieVan EddieVan is offline
 
Join Date: Oct 2008
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Lynne.

You are correct. We are automatically generating HTML pages from corporate internal infomation that we would like to restrict access to. The people that we would like to be able to read the pages would be members of our forum, as we are pretty strict on whom those members are. Being able to further restrict based on groups is even better. I had reviewed a few threads here, and the ones I read seemed geared towards specific versions (3.5 and 3.6).

Two other issues we're keeping in mind are: ease to configure that access [after all, there may be many HTML pages, and the will likely be regenerated on a regular basis], and ease for patching vBullein [we'd like to stay current, and don't want to have to re-implement the mod each time].

Thanks again,
Reply With Quote
  #9  
Old 02-27-2009, 11:12 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by EddieVan View Post
ease to configure that access [after all, there may be many HTML pages, and the will likely be regenerated on a regular basis]
Create a separate PHP file with an array that indicates which groups get access. On your files, include that file and use this array for the is_member_of() function.
Quote:
Originally Posted by EddieVan View Post
ease for patching vBullein [we'd like to stay current, and don't want to have to re-implement the mod each time].
I can nearly guarantee you that is_member_of() will not break.
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 12:23 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03959 seconds
  • Memory Usage 2,242KB
  • Queries Executed 13 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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_postinfo_query
  • fetch_postinfo
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete