This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Setup & design » Showing links to protected areas

Showing links to protected areas

Showing links to protected areas

Wednesday 18 February 2004 6:56:37 am - 4 replies


I have a main list of folders for a site which makes up the main menu. One requires authenticated access, so it doesn't show in the list unless a logged in user visits the site. How can I have the item show in the list even when an anonymous user visits resulting in it prompting for login?

Is there something I can supply to the fetch? If I hardcode the link it doubles up the link (1 is hardcoded, the other is from the fetch) when an authenitcated user visits the page. Or, do I need to test for a logged in user and not show the link twice manually?

Monday 13 June 2005 6:57:09 pm

I am having this exact problem. Did anyone ever determine a solution? I need to show the links to content so that non-members get excited about the things they can't access, at which time they are redirected to a login/join page.

Seems like there should be a way to have the fetch ignore the permission/roles.

Tuesday 14 June 2005 9:14:09 am

A fetch that ignore the access right would be a big security problem. However, you can do that from an extension at the php level if you wish.

Anyway, the easiest solution (well, the one I use) is to test if the user is anonymous. If he's, then display the hardcoded link, otherwise, don't has it will be displayed from the regular fetch.


Wednesday 15 June 2005 10:53:08 pm

I ended up creating a solution for this, by modifying the pagelayout.tpl to show a message in place of the content if it is in the Members section.

The anonymous user has access to the member section, but the content display is limited by the template.

{* Determine if this page is in the Members section, and if not, show it normally *}
{section show=ne($module_result.section_id,6)}



{* If it is in the members section, determine if the user is logged as a member of the group which has access rights, and if so, show them the content normally *}
{let current_user=fetch('user','current_user') }
{section show=eq($current_user.contentobject.main_parent_node_id,157)}



{* If the content is restricted, and the user is not logged in, display a message in place of the content *}

<h1>Sorry, this page is restricted</h1>

<p>The page you have requested is reserved for <b>FAIFA members only</b>. To take advantage of this and all of the other valuable benefits of members, please consider joining FAIFA. </p>

<p>If you are a current member, you may <a href="/user/login">log in here to access this page</a>. If you are a current member but do not have your user ID or password, please <a href="/contact_us/">contact us to request a user ID and password. </a></p>




Thursday 18 October 2012 7:32:07 pm


Does this still work with 4.3?

if so, where in the pagelayout.tpl do i put it?

thanks in advance


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from