Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 03-17-2005, 11:43 AM
Mile-O-Phile Mile-O-Phile is offline
 
Join Date: Nov 2004
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Show Mods And Admin on Non-vb PHP Page

I have a line on my home page that offers links to various parts of my site (i.e. Home, News, Links, Resource, Quizzes, etc.) but I would like to add a further section to the line (namely 'Admin') that will only appear in the list if one of the people browsing the page is either myself or one of the moderators from my forum.

How could I do this?
Reply With Quote
  #2  
Old 03-17-2005, 06:08 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

if it's a vB-powered page then you can use the is_member_of function() in a conditional

alternatively you can go old school with

PHP Code:
if ($bbuserinfo['usergroupid'] == OR $bbuserinfo['usergroupid'] == or $bbuserinfo['usergroupid'] == XX)
{
    
your block of code here

the same applies if you're using templates too.
Reply With Quote
  #3  
Old 03-18-2005, 07:16 AM
Mile-O-Phile Mile-O-Phile is offline
 
Join Date: Nov 2004
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by sabret00the
if it's a vB-powered page then you can use the is_member_of function() in a conditional

alternatively you can go old school with

PHP Code:
if ($bbuserinfo['usergroupid'] == OR $bbuserinfo['usergroupid'] == or $bbuserinfo['usergroupid'] == XX)
{
    
your block of code here

the same applies if you're using templates too.
Thanks, but as the title of the thread states, it's a non-vb page. It's my index.php of my main site.
Reply With Quote
  #4  
Old 03-18-2005, 07:59 AM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

then in that case check the session.php see if it defines the usergroup in the cookies and then use $_COOKIE['usergroupid']

alternatively you could include the vb-global.php just for that piece of code.
Reply With Quote
  #5  
Old 03-18-2005, 08:01 AM
Mile-O-Phile Mile-O-Phile is offline
 
Join Date: Nov 2004
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by sabret00the
then in that case check the session.php see if it defines the usergroup in the cookies and then use $_COOKIE['usergroupid']

alternatively you could include the vb-global.php just for that piece of code.
Thanks again, but my knowledge of PHP is limited to passing a variable to a page and if...else... constructs.

vBulletin's structure is way beyond my understanding.

What steps are necessary to do this?
Reply With Quote
  #6  
Old 03-18-2005, 08:27 AM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

chick this with marco or someone else that will come in this thread but

PHP Code:
rest of your page;

include(
"forums/global.php");
code i showed you before;
unset(
"forums/global.php"); //not sure if you can unset a file like that that's why you need a master coder in here
more of your page
Reply With Quote
  #7  
Old 03-18-2005, 08:42 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No you can NOT use unset on a file, only on a variable. (lol not a master coder myself )
Quote:
Originally Posted by sabret00the
chick this with marco
Hmm a nice chick
Reply With Quote
  #8  
Old 03-18-2005, 10:55 AM
Mile-O-Phile Mile-O-Phile is offline
 
Join Date: Nov 2004
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, I messed around with an example page. Just used this:

PHP Code:
<?php
include("forum/global.php"); 
$admin $_COOKIE['usergroupid'];
?>
<html>
<head>
<title>Example</title>
</head>
<body>
<?php
    
echo $admin;
?>
</body>
</html>
The page is here.

I got the following errors:

Warning: main(./includes/init.php): failed to open stream: No such file or directory in /home/linguami/public_html/forum/global.php on line 18

Fatal error: main(): Failed opening required './includes/init.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/linguami/public_html/forum/global.php on line 18

Now what?
Reply With Quote
  #9  
Old 03-18-2005, 11:35 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Change to:
PHP Code:
<?php 
chdir
("/home/linguami/public_html/forum");
include(
"./global.php"); 
....
Reply With Quote
  #10  
Old 03-18-2005, 11:39 AM
Mile-O-Phile Mile-O-Phile is offline
 
Join Date: Nov 2004
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MarcoH64
Change to:
PHP Code:
<?php 
chdir
("/home/linguami/public_html/forum");
include(
"./global.php"); 
....
Thanks. I've now done that and I'm getting a blank HTML page. I added the world Hello to it like this:

PHP Code:
<?php
chdir
("/home/linguami/public_html/forum"); 
include(
"./global.php");
$admin $_COOKIE['usergroupid'];
?>
<html>
<head>
<title>Example</title>
</head>
<body>
<?php
    
echo "Hello $admin";
?>
</body>
</html>
But the variable $admin isn't getting anything. I know there should be a cookie as I'm logged into my forum at the moment.
Reply With Quote
Reply

Thread Tools
Display Modes

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 02:47 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05086 seconds
  • Memory Usage 2,265KB
  • Queries Executed 11 (?)
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
  • (7)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete