Page 1 of 1

[FEU] check if user is allowed to view this page

Posted: Sat Feb 18, 2012 1:51 am
by mcDavid
I'm trying to set up my website with the new Protected Content content-type to protect some pages. Only problem is: some protected pages have a different template than the login form. So the {content} area is not big enough to hold the login form.
So I'm trying to make my template check if the content is protected and the user is allowed to view it.
I tried using {if $ccuser->loggedin()}, but this only partially works because if the user is logged in but is not allowed to view this page, he still gets to see te login form in the {content} area.
So I tried to find a smarty variable that tells me if the user is allowed to view the content, and I found it:
{$content_obj->feu_protected_page->_contentBlocksLoaded:protected}
But, this doesn't work, because the ":protected" part.

Does anybody know an easy way to check this? Maybe with a user defined tag?

Re: [FEU] check if user is allowed to view this page

Posted: Sat Feb 18, 2012 2:49 am
by cleatus
well, this may not be what you're after but you could set feu to redirect to separate page in FEU> preferences>protected page settings instead of "show login form". right now it sounds like it's trying to show contact form inside your other pages as you described.

Re: [FEU] check if user is allowed to view this page

Posted: Sat Feb 18, 2012 3:02 am
by mcDavid
that's not an option, because you don't get redirected back to the page you are looking for after logging in.

Re: [FEU] check if user is allowed to view this page

Posted: Sat Feb 18, 2012 4:07 am
by cleatus
maybe if you used custom content to protect page instead of FEU protected content then the custom content method would work fully?

Re: [FEU] check if user is allowed to view this page

Posted: Sat Feb 18, 2012 5:24 am
by jmcgin51
mcDavid wrote:that's not an option, because you don't get redirected back to the page you are looking for after logging in.
you can with a little Smarty magic

Re: [FEU] check if user is allowed to view this page

Posted: Sat Feb 18, 2012 6:38 pm
by mcDavid
cleatus wrote:maybe if you used custom content to protect page instead of FEU protected content then the custom content method would work fully?
That's how it's working now, it works fine but it means I have a lot of templates, one for each possible combination of rights... And that's exactly what I'm trying to get rid off ;)
jmcgin51 wrote:
mcDavid wrote:that's not an option, because you don't get redirected back to the page you are looking for after logging in.
you can with a little Smarty magic
How would I do that? I'd somehow have to send a return-id along with the redirect?
It would be a solution but I still think a login without redirect would be nicer.

Re: [FEU] check if user is allowed to view this page

Posted: Sun Feb 19, 2012 12:16 am
by cleatus
i'm not currently using this functionality but maybe the last post on this thread works?
http://forum.cmsmadesimple.org/viewtopic.php?t=44492