PDA

View Full Version : vB info on the main page of a site?


BrownieDX
10 Nov 2001, 22:29
Like the webmasters have done here, I want to put a table cell on my site which contains the user's info about his vB account, as well as the last 5 posts. I know how to get the last five posts, but how do i get the user's info?

GlobalFusion
15 Aug 2005, 14:45
Easy.

As long as you have called global.php, all that info is available to you.

$bbuserinfo[musername]
$bbuserinfo[usergroupid] etc etc.

Probably better to make a template then serve the page as a VB page.


------------------------------------

First, create a PHP page

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

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'your_page_name'); // change this depending on your filename

// ################### 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(
'your_template_name',
);

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

);

// ######################### REQUIRE BACK-END ############################
require_once('/path/to/your/forums/global.php');


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

$navbits = array();
$navbits[$parent] = 'Page Name For NavBar';

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


?>


Then upload it where its needed. (root dir to make things simple)

then in your AdminCP, in the Style Manager - create a new Template


$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle]</title>
$headinclude
</head>
<body>
$header

$navbar

<YOUR CONTENT HERE>

$footer
</body>
</html>



Be sure to keep your names matching (template name in your PHP file refers to the new template you just made - so keep the name the same)


And then, furthermore, you can easily add the 'Who's Online' data to you includes/functions_online.php file so you dont get the 'Unknown Location' in the WOL.


BTW - this is based on a VB 3.0.8 installation (just realised the initial post date - oops)

Wordplay
15 Aug 2005, 14:55
or you could always just use vbadvanced, that pretty much has all the tables you'll need.

Dean C
15 Aug 2005, 16:00
This thread is 4 years old!