Page 1 of 1
FEU: protected part of a page
Posted: Tue May 19, 2020 6:22 pm
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
and for another part
. 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
, but that didn't do the trick. If it's not possible, than I'll a lot of unique groups, which is a hack.
Re: FEU: protected part of a page
Posted: Thu May 21, 2020 8:26 pm
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.
Re: FEU: protected part of a page
Posted: Thu May 21, 2020 8:35 pm
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.
Re: FEU: protected part of a page
Posted: Mon May 25, 2020 10:24 am
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.
Re: FEU: protected part of a page
Posted: Mon May 25, 2020 3:41 pm
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.
Re: FEU: protected part of a page
Posted: Mon May 25, 2020 6:37 pm
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.
Re: FEU: protected part of a page
Posted: Mon May 25, 2020 7:17 pm
by DIGI3
I would try to diagnose why it's not working then - it should.