PDA

View Full Version : Adding certain varibles to cmps file


SmasherMaster
07-08-2004, 06:35 PM
I'm making a modification (http://www.vbulletin.org/forum/showthread.php?t=66969) And I need to insert some varibles into the cmps_index.php file without screwing it up with many errors. How can I do this correctly? Here's the phrases/varibles

// Require User Functions
require_once('./includes/functions_user.php');
// Top Row - Welcome Message
// Cell 1 - Avatar
$bbuserinfo['user_avatar']=fetch_avatar_url($bbuserinfo['userid']);
if($bbuserinfo['user_avatar']==""){
$bbuserinfo['user_avatar']="<img src='images/avatars/noavatar.gif' alt='Edit Your Avatar' border='0'>";
$bbuserinfo['user_avatar']="<a href='profile.php?{$session['sessionurl']}&do=editavatar'>{$bbuserinfo['user_avatar']}</a>";
$welcome_avatar=$bbuserinfo['user_avatar'];
} else {
$bbuserinfo['user_avatar']="<img src='{$bbuserinfo['user_avatar']}' alt='Edit Your Avatar' border='0'>";
$bbuserinfo['user_avatar']="<a href='profile.php?{$session['sessionurl']}&do=editavatar'>{$bbuserinfo['user_avatar']}</a>";
$welcome_avatar=$bbuserinfo['user_avatar'];
}
// Cell 2 - Quick Forum Stats
$welcome_new_posts=$DB_site->query_first("select count(*) as new_posts from ".TABLE_PREFIX."post where dateline > '{$bbuserinfo['lastvisit']}'");
$welcome_new_topics=$DB_site->query_first("select count(*) as new_topics from ".TABLE_PREFIX."thread where lastpost > '{$bbuserinfo['lastvisit']}'");
$total_members=$DB_site->query_first("select count(*) as all_users from ".TABLE_PREFIX."user");
$total_posts=$DB_site->query_first("select count(*) as all_posts from ".TABLE_PREFIX."post");
$total_topics=$DB_site->query_first("select count(*) as all_topics from ".TABLE_PREFIX."thread");
$welcome_members="{$total_members['all_users']}";
$welcome_topics="{$total_topics['all_topics']}";
$welcome_posts="{$total_posts['all_posts']}";
$welcome_pms="<if condition='$show[pmstats]'><br /><phrase 1='$vbphrase[unread_x_nav_compiled]' 2='$vbphrase[total_x_nav_compiled]' 3='$session[sessionurl]'>$vbphrase[private_messages_nav]</phrase></if>";
$welcome_newposts="<a href='search.php?{$session['sessionurl']}&do=getnew'>New Posts</a>: {$welcome_new_posts['new_posts']}<br>New Threads: {$welcome_new_topics['new_topics']}";
$welcome_time="<phrase 1='$vbphrase[last_visited_x_at_y]'>";

Brian
07-08-2004, 06:42 PM
Hmmm... Is this just going to affect the navbar? If so, you would need to add the different variables to the global variables section in the 'construct_adv_navbar' function (located in /forum/includes/vba_cmps_include_bottom.php). That will most likely be taken out of the function later though to prevent issues like this. ;)

Our Sponsors
 

SmasherMaster
07-08-2004, 08:54 PM
It should have only affected the navbar, as these phrases are only used there. But the varibles should have come up in the navbar box correct?

Did I make this edit right?


// ############################ Adv Navbar Function #################################
if (!function_exists('construct_adv_navbar'))
{
function construct_adv_navbar($navbits = '', $index = 'false')
{
global $vboptions, $vba_options, $vbphrase, $stylevar, $bbuserinfo, $show, $pmbox, $welcome_avatar, $welcome_newposts, $welcome_time, $welcome_pms, $welcome_posts, $welcome_topics, $welcome_members, $total_topics, $total_posts, $total_members, $welcome_new_topics, $welcome_new_posts, $bbuserinfo;

Brian
07-08-2004, 09:10 PM
Looks about right...

Our Sponsors
 

SmasherMaster
07-09-2004, 08:53 AM
My welcome panel is on my main site http://www.megareviews.com

As you see, many of the stuff is not filled in, but on the index of the forums it would appear fine! Somehow the varibles are not being registered...Perhaps I could put them in global.php?