acl for a frontend page

Have a programming question regarding your component, plug-in, extension or core hacks? Have an interesting tidbit, FAQ or programming tip you’d like to share? This is the place for you.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Post Reply
User avatar
linpi
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Sat Sep 23, 2006 6:35 am
Location: Berlin
Contact:

acl for a frontend page

Post by linpi » Fri Sep 14, 2007 1:26 pm

I woul'd like to restrict a page from a component in the frontend, for Registered user only , not over a menu button, over a link like:
... myhomepage/component/option,com_seminar/task,register/

I found in backend files the following example:

Code: Select all

if (!($acl->acl_check( 'administration', 'edit', 'users', $my->usertype, 'components', 'all' )
| $acl->acl_check( 'administration', 'edit', 'users', $my->usertype, 'components', 'com_comprofiler' ))) {
   mosRedirect( 'index2.php', _NOT_AUTH );
}

how to modify these lines for only registered user (not administration) ?
or is there a simpler way of doing this?
I'm using Joomla 1.0.13.
thank you for some tips. Pierre
Last edited by linpi on Fri Sep 14, 2007 7:52 pm, edited 1 time in total.

User avatar
linpi
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Sat Sep 23, 2006 6:35 am
Location: Berlin
Contact:

Re: acl for a frontend page

Post by linpi » Tue Sep 18, 2007 4:03 pm

I found a very easy way to restrict a front page to only registered user:

Code: Select all

if ($my->id == 0) {
   // user is not registered if user id is 0
   echo '<p>You have to login before you an see this page!</p>';
} else {


cheers Pierre


Post Reply