vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Restrict access to HTML pages using vBulletins login/password (https://vborg.vbsupport.ru/showthread.php?t=206621)

EddieVan 02-25-2009 09:11 PM

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

Lynne 02-25-2009 10:06 PM

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.

1Unreal 02-25-2009 11:08 PM

You can password protect forums in vB by default. If you used that it would be much more streamlined and easier all round.

Lynne 02-25-2009 11:18 PM

I don't think he is asking about forums, though. I got the impression he was asking about custom pages.

1Unreal 02-25-2009 11:21 PM

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.

Lynne 02-25-2009 11:25 PM

Quote:

Originally Posted by 1Unreal (Post 1754767)
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.

1Unreal 02-25-2009 11:30 PM

Hm...Ok. You win.

EddieVan 02-26-2009 06:21 PM

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,

Dismounted 02-27-2009 11:12 AM

Quote:

Originally Posted by EddieVan (Post 1755426)
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 (Post 1755426)
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.


All times are GMT. The time now is 10:00 AM.

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.01261 seconds
  • Memory Usage 1,732KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete