I have implemented the extended-users module following the tutorial here.
Now there is an index.php in the root. I want this to be accessible only if logged in when user is a registered user. So how do I check and redirect?
I found a code in the foorum:
I am also trying to check if the user is logged in using the code below in index.php:
But what happens is that the content of the index page is displayed even when no user is logged in. While I actually what to achieve that:
1. If user is not logged in, any url accessed should send user to login page including the main site url.
2. If user is logged in, then only pages allowed to be seen by the user should be displayed by using k_user_access_level conditionally. For example: if k_user_access_level ge '10' then redirect to couch admin panel but if k_user_access_level eq '4' then show index.php.
In other words, a registered user should never reach the couch admin at all while super-admin and admin should not be required to visit the front end, upon successful login.
Just wanted to know where to place the code to achieve the above. If someone could guide me with a structure, I would be really thankful.
Regards,
GenXCoders (Priya)
Now there is an index.php in the root. I want this to be accessible only if logged in when user is a registered user. So how do I check and redirect?
I found a code in the foorum:
- Code: Select all
<cms:if k_user_access_level ge '10' >
<cms:redirect url='http://www.google.com/' />
</cms:if>
I am also trying to check if the user is logged in using the code below in index.php:
- Code: Select all
<cms:if k_logged_in>
Logout <a href="<cms:logout_link redirect=k_site_link />"><cms:show k_user_title /></a>
<cms:else />
<a href="<cms:login_link />">Login</a>
</cms:if>
But what happens is that the content of the index page is displayed even when no user is logged in. While I actually what to achieve that:
1. If user is not logged in, any url accessed should send user to login page including the main site url.
2. If user is logged in, then only pages allowed to be seen by the user should be displayed by using k_user_access_level conditionally. For example: if k_user_access_level ge '10' then redirect to couch admin panel but if k_user_access_level eq '4' then show index.php.
In other words, a registered user should never reach the couch admin at all while super-admin and admin should not be required to visit the front end, upon successful login.
Just wanted to know where to place the code to achieve the above. If someone could guide me with a structure, I would be really thankful.
Regards,
GenXCoders (Priya)