FEU: protected part of a page

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
babel
Forum Members
Forum Members
Posts: 147
Joined: Fri Oct 19, 2012 8:58 pm

FEU: protected part of a page

Post by babel »

To see a website you have to be logged in. But there is a small part on the website which is only for one individual. This can be done with

Code: Select all

{feu_protect groups="Group_1"}
and for another part

Code: Select all

{feu_protect groups="Group_2"}
. This means I have to put every person that can log in in a unique group. It would be great if this protect could be accomplished with userid (lidnummer). I tried

Code: Select all

userid="123"
, but that didn't do the trick. If it's not possible, than I'll a lot of unique groups, which is a hack.
User avatar
rotezecke
Power Poster
Power Poster
Posts: 411
Joined: Fri Apr 18, 2008 9:34 pm
Location: Nimbin, Australia

Re: FEU: protected part of a page

Post by rotezecke »

i'm not sure i understand exactly what you are trying to do, but you can get the current userid

Code: Select all

{$currentUserId=feu_smarty::get_current_userid()}
Then place your content inside

Code: Select all

{if $currentUserId == 123}blah{/if}
Untested.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: FEU: protected part of a page

Post by velden »

And please note, for security reasons, if you're putting that logic in your page TEMPLATE, then do NOT use the default content block {content} to store the secret content.

You should use a different one. E.g. {content block=secret_content ... }

The reason for this that the content of the default content block can always be retrieved, no matter what logic is used in the page template.
babel
Forum Members
Forum Members
Posts: 147
Joined: Fri Oct 19, 2012 8:58 pm

Re: FEU: protected part of a page

Post by babel »

Thanks rotezecke. I tested your answer, but it's not the answer unfortunately. Basicly I want (a part of) a page only open for one person with an unique id. Now I only can accomplish this by giving every person an unique group-number. Using only the id would be better.

Velden, I know about the risks. But it's not for the default content-block. Thanks for warning me.
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1625
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: FEU: protected part of a page

Post by DIGI3 »

What doesn't work about the method rotezecke posted? I've used similar in the past to customize content for specific users with no issue.
Not getting the answer you need? CMSMS support options
babel
Forum Members
Forum Members
Posts: 147
Joined: Fri Oct 19, 2012 8:58 pm

Re: FEU: protected part of a page

Post by babel »

DIGI3, if I use the code rotezecke suggested, nothing shows on the page. If I use

Code: Select all

{feu_protect groups="Student_1"}some content {/feu_protect}
some content is only shown to the person in the group Student_1.
I hope it's clear what I mean.
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1625
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: FEU: protected part of a page

Post by DIGI3 »

I would try to diagnose why it's not working then - it should.
Not getting the answer you need? CMSMS support options
Post Reply

Return to “Modules/Add-Ons”