cookies with editabletext web parts

Rita Mikusch asked on September 12, 2018 22:41

Hi,

I want some "editabletext" content to only appear to website visitors if they have a specific cookie with a specific value saved in their browser.

That was pretty easy ... I just added a macro to the webpart's "visible" field to check that cookie. It works ALMOST perfectly:

{% if (DecryptString(Cookies["theCookie"]]) == "theCookieValue") {true} else {false} #%}

The one problem I'm having is that "visible" field also affects whether the content editors can see that "editabletext" editing area. If that cookie isn't set to the correct value, they can't access the editabletext item to edit the content!

Is there any way I can make that "editabletext" ALWAYS visible in kentico admin ... but only visible to website visitors if they have that specific cookie set?

thank you, Rita.

Correct Answer

Peter Mogilnitski answered on September 12, 2018 23:45

You need to check viewmode: {% if ((ViewMode == "LiveSite") &&(DecryptString(Cookies["theCookie"]]) == "theCookieValue")) {true} else {false} |(identity)GlobalAdministrator%}

0 votesVote for this answer Unmark Correct answer

Recent Answers


Rita Mikusch answered on September 12, 2018 23:52

Thank you!!!

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.