2

I am trying to show content to super user in joomla front end

  1. Showing parse syntax error
  2. Is the code correct for using authorise('core.admin')) to find super user in joomla 3.6.2 or is there a more better and secure way

    <?php //i want this to display only to super users
    $user = JFactory::getUser();
    if($user->authorise('core.admin'))
    {
    <li><a class="modal" href="http://localhost/code/index.php?option=com_rsform&formId=51&form[Email]=<?php echo $this->prodDet->email; ?>&form[Make]=<?php echo $this->CatName; ?>&form[Model]=<?php echo $this->prodDet->prod_name;?>&tmpl=component" rel="{handler: 'iframe', size: {x: 590, y: 420}}"><img src="<?php echo $this->baseurl ?>/templates/proto/images/contact.jpg"/></a></li>
    }
    ?>
    
3

you have some error in your code. Please try this :

<?php //i want this to display only to super users
$user = JFactory::getUser();
if($user->authorise('core.admin'))
{
?><li><a class="modal" href="http://localhost/code/index.php?option=com_rsform&formId=51&form[Email]=<?php echo $this->prodDet->email; ?>&form[Make]=<?php echo $this->CatName; ?>&form[Model]=<?php echo $this->prodDet->prod_name;?>&tmpl=component" rel="{handler: 'iframe', size: {x: 590, y: 420}}"><img src="<?php echo $this->baseurl ?>/templates/proto/images/contact.jpg"/></a></li>
<?php 
}
?>
| improve this answer | |
  • thanks it works, just a thing more does if($user->authorise('core.admin')) is secure code for checking whether a user is super admin – Ruchika Oct 9 '16 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.