PDA

View Full Version : Sort of a hack....


drews
11-24-2002, 11:50 PM
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:

<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:

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


with


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: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:


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
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:
$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. :)