Forums

Show "Edit Record" only when logged in

flyboeing 16 Dec, 2011
Hello all,

Is it possible to show the 'Edit Record' text/button only when you are logged in? I have a group of admins for my website and if one of them is logged in, it has to see the 'Edit Record' text/button. If someone is visiting the website and see the records, it won't have to see the 'Edit Record' text/button.

Can someone help me with this?
GreyHead 16 Dec, 2011
Hi Ruud,

Doesn't this work automatically from the Permissions settings?

I usually use the normal getUser code to hide or display the links as needed:
<?php
$user =& JFactory::getUser();
if ( $user->gid ) {
  $edit_record = // some link code
} else {
  $edit_record = '';
}
?>
. . .

<?php echo $edit_record; ?>

Bob
flyboeing 16 Dec, 2011
Thank you bob, for your reply :wink:

I didn't try the permission thing, I thought it didn't work. But I tried it and it works very well. But I used the script you gave me because I wanted to hide the 'edit' column in my overview. When the admins are logged in, the see the 'edit column' and the edit button :wink:

Thanks a lot!!

Kind regards,
Ruud
This topic is locked and no more replies can be posted.