Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 09-04-2016, 04:35 PM
parayna's Avatar
parayna parayna is offline
Member
 
Join Date: May 2013
Location: Devon, UK
Posts: 342
Gender: Female
Credits: 16,519
parayna is on a distinguished road
Default How To Add AdminCP Link To Sidebar

I'm using a smarty built sidebar that is created using the themes template.tpl file. What do I need to add to have the Admin Control Panel link only visible to admins? A bit like it is if you are using the normal method of having the sidebar. I have tried figuring it out but I can't XD All I have so far is this:

PHP Code:
<a href="{$home}admincp">Admin Control Panel</a
And this is my whole file if anyone wants to see the way it is laid out:

PHP Code:
   {include file="{$root}{$temp}{$theme}/header.tpl"}

<
body>
<
div id="wrapper">
<
table cellspacing="3px" cellpadding="0px">
<
tr><td colspan="2" id="image"><span><center><a href="{$path}index">{$site_name}</a></center></span></td></tr>
<
tr><th colspan="2">{$menu}</th></tr>
<
tr><td id="menu">
<
b><p><u>{$smarty.now|date_format},
{
$smarty.now|date_format:"%I:%M %p"}</u></p></b>
{if 
$logged_in}
<
br><br><br><br><br><p><b>You are logged in as:</b></p>
<
a href="{$home}profile/view/{$username}"><font size="4"><b>{$username}</b></font></a>
<
p>{$avatar}</p>
<
p>You have <i>{$cash} {$mysidia->settings->cost}</i>Credits!</p>
<
a href="{$home}messages">{$messagesMessages</a>
<
a href="{$home}login/logout">Log Out</a>
<
a href="{$home}admincp">Admin Control Panel</a>{/if}
<
br><br>
<
br>{$sidebar}
<
a href="{$home}online">{$online}</a><br><br>     

</
td><td id="content">
<
h1>{$document_title}</h1>
<
p>{$document_content}</p>

</
td></tr>
<
tr><td colspan="2" id="footer">{$footer}</td></tr>
</
table>
</
div>

</
body>

</
html
Thank you!
Reply With Quote
  #2  
Old 09-04-2016, 07:10 PM
Dinocanid's Avatar
Dinocanid Dinocanid is offline
Member
 
Join Date: Aug 2016
Location: Maryland, USA
Posts: 516
Gender: Unknown/Other
Credits: 65,339
Dinocanid is on a distinguished road
Default

There's this block of code from class_sidebar.php:

Quote:
if($mysidia->user instanceof Admin){
$adminCP = new Link("admincp/", FALSE, FALSE);
$adminCP->setText("Admin Control Panel");
$adminCP->setListed(TRUE);
$linksList->add($adminCP);
Reply With Quote
  #3  
Old 09-05-2016, 11:28 AM
parayna's Avatar
parayna parayna is offline
Member
 
Join Date: May 2013
Location: Devon, UK
Posts: 342
Gender: Female
Credits: 16,519
parayna is on a distinguished road
Default

I suppose that's a step in the right direction XD I need to figure out what to input so it can be in the template.tpl file... that just displays as text (might as well try it, eh? XD) and I need the code to somehow say 'if user is admin/uid=1, show this text'... I'm a bit lost still though XD I've tried a few things, but no luck so far!
Reply With Quote
  #4  
Old 09-05-2016, 12:14 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 334,019
Hall of Famer is on a distinguished road
Default

Mysidia only uses smarty templates for the basic layout, it generates html contents using GUI objects. Its possible to do what you want by assigning smarty template variables, such as $isAdmin, which is the boolean value of ($mysidia->user instanceof Admin). It may be a bit complex for you though.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #5  
Old 09-05-2016, 01:03 PM
parayna's Avatar
parayna parayna is offline
Member
 
Join Date: May 2013
Location: Devon, UK
Posts: 342
Gender: Female
Credits: 16,519
parayna is on a distinguished road
Default

I did it! :D I opened class_template and put this in:

PHP Code:
$this->assign("isAdmin",$mysidia->user instanceof Admin); 
And then put:

PHP Code:
{if $isAdmin}<a href="{$home}admincp">Admin Control Panel</a>{/if} 
I can't believe it worked >.> I logged in with the second account I have as a normal member and the link wasn't there. So proud of myself right now T-T I was winging it... XD
Reply With Quote
Reply


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 -5. The time now is 11:22 AM.

Currently Active Users: 9783 (0 members and 9783 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636