vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Using the vB Login for a page (https://vborg.vbsupport.ru/showthread.php?t=249358)

Arven 08-26-2010 10:08 AM

Using the vB Login for a page
 
Hi!

Hit me with a hammer, I can't find the right keyword to search for it - maybe you can point me into the right direction.

I want to program a page that offers different content based on the user group a person is registered for in vb (currently 3.6.8, but I'll likely update to 3.8.6).

So: Everybody is allowed to see content A, but only those registered for the group "members" are allowed to see content B.

How do I do that in vB?

I have done something like this in the past, but got stuck:

Code:

<?php

// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// ##################### DEFINE IMPORTANT CONSTANTS #######################
// change the line below to the actual filename without ".php" extention.
// the reason for using actual filename without extention as a value of this constant is to ensure uniqueness of the value throughout every PHP file of any given vBulletin installation.

define('THIS_SCRIPT', 'uwodb');

// #################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array();

// pre-cache templates used by all actions
$globaltemplates = array(
        // change the lines below to the list of actual templates used in the script
        'uwodb_test',
                'uwodb_fullaccess',
);

// pre-cache templates used by specific actions
$actiontemplates = array();

// ########################## REQUIRE BACK-END ############################
require_once('./global.php');

// #################### HARD CODE JAVASCRIPT PATHS ########################
$headinclude = str_replace('clientscript', $vbulletin->options['bburl'] . '/clientscript', $headinclude);

// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################

$navbits = array();
// change the line below to contain whatever you want to show in the navbar (title of your custom page)
$navbits[$parent] = 'the Ultimate Warlord Online Deck Builder';

$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');

// change the line below to contain the name of the actual main output template used in your script
if (is_member_of($vbulletin->userinfo, 14) OR is_member_of($vbulletin->userinfo, 16)) // is_member_of($vbulletin->userinfo, 6) OR
        {
        eval('print_output("' . fetch_template('uwodb_test') . '");');
        } 
elseif (is_member_of($vbulletin->userinfo, 6) OR is_member_of($vbulletin->userinfo, 2)) {
eval('print_output("' . fetch_template('uwodb_test') . '");');
//eval('print_output("' . fetch_template('uwodb_free') . '");');
        }
else {
                print_no_permission();
        }

?>

Basically all I want to use is a header (even that is optional) and the vb user administration/cookies/whatever.

Thanks!

BirdOPrey5 08-26-2010 05:41 PM

There is an article on how to make a 'blank' VB page in the V3 articles sections... Then in the template it instructs you to make you'd put the content you want everyone to see.

The content you want just 1 or more usergroups to see you'd put in a conditional IF statement saying IF user is a member of usergroups X, Y, or Z show them the content else show nothing or alternate content.

Conditional statements are also discussed in another article.

Arven 08-27-2010 07:18 AM

Ah, thank you. I hadn't even noticed the articles section yet!

Now my question appears to be a little bit ... redundant ;-).


All times are GMT. The time now is 09:27 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.00973 seconds
  • Memory Usage 1,730KB
  • 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_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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