TAV1702 Posted October 30, 2009 Report Share Posted October 30, 2009 Hi everyone. I have a quick question if I may. I have not done very much stuff in the past using echo. I always shyed away from it. I have edited my downloads page in my template I call Crystal 2 to match the admin downloads list. Now on to my question. I want it to know if it is an admin or a regular user. If it IS an admin I want it to display this info. <span style="font-size: 8pt">[<a id="dialog" class="jqModal" href="<?php echo SITE_URL?>/admin/action.php/downloads/editcategory?id=<?php echo $category->id?>">Edit</a>] | [<a class="ajaxcall" action="deletecategory" id="<?php echo $category->id?>" href="<?php echo SITE_URL?>/admin/action.php/downloads">Delete</a>] | [<a id="dialog" class="jqModal" href="<?php echo SITE_URL?>/admin/action.php/downloads/adddownload?cat=<?php echo $category->id?>">Add Download</a>]</span> I know how to make it know if it an admin or not by using if(Auth::LoggedIn()) { if(PilotGroups::group_has_perm(Auth::$usergroups, ACCESS_ADMIN)) { CONTENT WOULD GO HERE } ?> I have tried several ways to get this to work with no success. Can anyone give me a hand with this? It would really be appreciated. And this code if successful would allow an admin to edit downloads and add without having to go to the admin panel every time. Like If I found a simple typo or something I could fix it right then and there. Here is my page currently as it sits right now. So right next to category name, it would have [Edit] | [Delete] | [Add Download] If I figure it out, I will come back and delete or mark this as solved. Thanks P.S. So I'm a dork. This should be moved to Skinning please. Sorry Nabeel Quote Link to comment Share on other sites More sharing options...
Tom Posted October 30, 2009 Report Share Posted October 30, 2009 So you're saying the first code is what you want to display if they have admin permissions... try: <? if(Auth::LoggedIn()) { if(PilotGroups::group_has_perm(Auth::$usergroups, ACCESS_ADMIN)) { echo ' ?> <span style="font-size: 8pt">[<a id="dialog" class="jqModal" href="<?php echo SITE_URL?>/admin/action.php/downloads/editcategory?id=<?php echo $category->id?>">Edit</a>] | [<a class="ajaxcall" action="deletecategory" id="<?php echo $category->id?>" href="<?php echo SITE_URL?>/admin/action.php/downloads">Delete</a>] | [<a id="dialog" class="jqModal" href="<?php echo SITE_URL?>/admin/action.php/downloads/adddownload?cat=<?php echo $category->id?>">Add Download</a>]</span> <? '; } } ?> Quote Link to comment Share on other sites More sharing options...
TAV1702 Posted October 30, 2009 Author Report Share Posted October 30, 2009 Yeah... Let me give that a try right quick. Thanks Tom Quote Link to comment Share on other sites More sharing options...
TAV1702 Posted October 30, 2009 Author Report Share Posted October 30, 2009 Yeah that actually worked but busted up the template real bad. I can refine it to make it work for my template. Thanks again Tom. I appreciate it. Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted October 30, 2009 Administrators Report Share Posted October 30, 2009 There shouldn't be an echo' there, or closing that echo. That will screw it up. But I doubt that code will work since it requires things in the admin panel. What are you trying to do? Quote Link to comment Share on other sites More sharing options...
TAV1702 Posted October 31, 2009 Author Report Share Posted October 31, 2009 Well, I have not messed with it again since I posted this earlier. Been taking care of the baby and all. What I was wanting to do was make it so that next to each category name for example: FS9 Fleet it would checkj my usergroup and if I was an admin it would then show me FS9 Fleet [Edit] | [Delete] | [Add Download] and if I was a regular user (non admin) it would simply show the category name only. I tried it the way I originally had it and it worked per the code he gave. The extra pages that were clicked on to edit or add were uglier than ape, but they worked as far as I could tell. I guess it is just as easy to go to the admin panel. Was just trying to be lazy is all and try something new. Really, I am messing with the code in the system trying new things so I can learn how it all works. I have pulled off a few little stunts on my own so far that have worked out so figured it wouldn't hurt to give this one a try either Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted October 31, 2009 Administrators Report Share Posted October 31, 2009 Yeah gotcha. Well, that wouldn't work since it relies on javascript popups which sit in the backend, but it's still worth it for learning Quote Link to comment Share on other sites More sharing options...
TAV1702 Posted October 31, 2009 Author Report Share Posted October 31, 2009 Yeah I figured it needed the backend after all was said and done. Been tweaking and messing around and I have a really nice looking dowloads list now for the crystal template. The default one is ok, but the one I did to make it look like that admin list is sweet. Should take a peak at it and consider it. Looks real nice and clean. Code could use some scrubbing to polish the edges but it is nice. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.