vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Sort of a hack.... (https://vborg.vbsupport.ru/showthread.php?t=46082)

drews 11-24-2002 11:50 PM

Sort of a hack....
 
Ok, I would like add an admin button to the top along with the other buttons (user cp, register, search, etc). So I created a new template called forumhome_loggedin_admin and the added:

Code:

<a href="admin/index.phps=$session[sessionhash]"><img src="https://vborg.vbsupport.ru/images/top_admin.gif"></a>
and then in global.php I replaced:

PHP Code:

eval("\$headinclude = \"".gettemplate('headinclude')."\";");
eval(
"\$header .= \"".gettemplate('header')."\";");
eval(
"\$footer .= \"".gettemplate('footer')."\";"); 

with

PHP Code:

eval("\$headinclude = \"".gettemplate('headinclude')."\";");
eval(
"\$header .= \"".gettemplate('header')."\";");
if(
$bbuserinfo['usergroup']==6) {
  eval(
"\$loggedinadmin .= \"".gettemplate('forumhome_loggedin_admin')."\";");
  eval(
"\$footer .= \"".gettemplate('footer')."\";");
} else {
  eval(
"\$footer .= \"".gettemplate('footer')."\";");


And then in the template header I added $loggedinadmin where I wanted it.

However for some reason, it doesn't show up...There are no errors and the other buttons work, I am using vB 2.2.9 if that helps..

Can anyone think of what I am missing, or did I change the code in the wrong spot?

Please help!

FWC 11-25-2002 04:56 AM

It should be:
PHP Code:

if($bbuserinfo['usergroupid']==6) { 


Erwin 11-25-2002 06:29 AM

Btw, if you just want to add an admin button, what you are doing there is way too complicated. You don't even need to hack any PHP files. Just template edits.

Do this:

Open phpinclude template,

Add this to the bottom of the template:

PHP Code:

if($bbuserinfo['usergroupid']==6) {
$adminbutton='<a href="admin/index.phps=$session[sessionhash]"><img src="https://vborg.vbsupport.ru/images/top_admin.gif></a>';
} else {
$adminbutton='';


Then open header template:

Add $adminbutton where you want to show up. It will just show up for admins.

Done! No need file hacking or extra templates! :)

drews 11-25-2002 02:04 PM

1 Attachment(s)
THanks Erwin....that worked....almost perfectly. But now for some reason there is a black border around the button. So what is the big difference between this and all the other buttons??

I attaches the screenshot of the black border.

Xenon 11-25-2002 02:22 PM

use this:
PHP Code:

$adminbutton='<a href="admin/index.phps=$session[sessionhash]"><img src="https://vborg.vbsupport.ru/images/top_admin.gif" border=0></a>'

also just a tip, you're first version couldn't work, you have used $loggedinadmin in your headertemplate before this variable has been created ^^
look, it was defined afterwards...

nevertheless, for such things a template conditional hack would help you
look for logician's :)

drews 11-25-2002 04:43 PM

Thanks guys! It works now. I don't know why I didn't think of using Logician's hack. Anyway, thanks for your help

Erwin 11-25-2002 07:53 PM

Yeah, never forget border="0" if you're linking images. :)


All times are GMT. The time now is 06:22 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.01053 seconds
  • Memory Usage 1,731KB
  • 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
  • (5)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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