Macro doesn't work for public

Mark Ellis asked on October 14, 2014 07:47

Hi,

I have this macro that only seems to work for the administrator when logged in.

If I'm the admin, the content fills correctly in preview mode using the grandchild's "copy" field. For everyone else it displays the default text.

<meta property="og:description" content="{%FacebookShareDescription.ToString()==""?(Documents.WithAllData[CurrentDocument.Children.FirstItem.Children.FirstItem.GetValue("NodeAliasPath")].GetValue("copy")==""?"Default text here":String.StripHtml(Documents.WithAllData[CurrentDocument.Children.FirstItem.Children.FirstItem.GetValue("NodeAliasPath")].GetValue("copy"))):FacebookShareDescription@%}" />

I've tried using an @ symbol instead of the # at the end but then nothing at all shows regardless of role.

I believe the problem is this part as everything else seems to work.

Documents.WithAllData[CurrentDocument.Children.FirstItem.Children.FirstItem.GetValue("NodeAliasPath")].GetValue("copy")

Is there a way I can make that work correctly for every viewer of the page regardless of role?

Recent Answers


Mark Ellis answered on October 14, 2014 08:48

That part that is cut off is actually:

GetValue("NodeAliasPath")].GetValue("Copy")

0 votesVote for this answer Mark as a Correct answer

Juraj Komlosi answered on October 14, 2014 10:30

Hi Mark,

you can find the answer to your question here.

The document macros are not resolved for public users from the security reasons. Since you try to access the document collection as a public user, it will return the null value. The public user doesn't have permission to access any documents.

Best regards,
Juraj Komlosi

1 votesVote for this answer Mark as a Correct answer

Mark Ellis answered on October 15, 2014 00:25

Yep that's fixed it.

Thanks

0 votesVote for this answer Mark as a Correct answer

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