a-ok Posted May 9, 2018 Share Posted May 9, 2018 I'm having a bit of a weird issue. I have a pageReferenceField on a couple of different templates (it's the same field) and under two of the templates it seems to work fine but under one of the templates the field will only return when I'm logged in. I have tested this with a few things (different browsers) and when checking the count it shows int(1) when logged in but int(0) on the other browser/incognito mode (not logged in). I then tested the viewability of the field with $page->viewable('field_name'); and on both logged in and logged out states they return bool(true) which made me even more confused. Is there anything I can be checking? I use ProCache on the site but I've turned it off locally for these tests. Link to comment Share on other sites More sharing options...
wbmnfktr Posted May 9, 2018 Share Posted May 9, 2018 Is the referenced page viewable for guests? Link to comment Share on other sites More sharing options...
a-ok Posted May 9, 2018 Author Share Posted May 9, 2018 4 minutes ago, wbmnfktr said: Is the referenced page viewable for guests? Yep! I’m assuming so? No specific permissions set. Link to comment Share on other sites More sharing options...
wbmnfktr Posted May 9, 2018 Share Posted May 9, 2018 Double check that the page is published and not hidden or unpublished or restricted in any kind. Link to comment Share on other sites More sharing options...
a-ok Posted May 9, 2018 Author Share Posted May 9, 2018 21 minutes ago, wbmnfktr said: Double check that the page is published and not hidden or unpublished or restricted in any kind. Yep it's all good Link to comment Share on other sites More sharing options...
wbmnfktr Posted May 9, 2018 Share Posted May 9, 2018 I'm out of ideas by now. Everything else would be guessing. I'd double check everything. Templates, fields, pages, referenced pages, queries. Link to comment Share on other sites More sharing options...
a-ok Posted May 9, 2018 Author Share Posted May 9, 2018 5 minutes ago, wbmnfktr said: I'm out of ideas by now. Everything else would be guessing. I'd double check everything. Templates, fields, pages, referenced pages, queries. I stuck the same test on the other template (count of the field and $page->viewable('field_name')) and the count is returned when logged out but on the other template it's not. I've checked all templates, fields, page etc. It's the same field on both templates. Is there a way to check a field access via API? Link to comment Share on other sites More sharing options...
wbmnfktr Posted May 9, 2018 Share Posted May 9, 2018 30 minutes ago, oma said: Is there a way to check a field access via API? I don't know but I guess there are ways to check it via API. If it's the same field as in other templates and if there are no permissions set for that field there must be another problem. Right now without knowing anything about templates, fields, references, or queries I'm out. Link to comment Share on other sites More sharing options...
bernhard Posted May 9, 2018 Share Posted May 9, 2018 Do you have a multilang setup? Maybe the page is not active in one language? Link to comment Share on other sites More sharing options...
kixe Posted May 10, 2018 Share Posted May 10, 2018 16 hours ago, oma said: Is there a way to check a field access via API? Yes $field = 'pass'; // field to check $template = 'user'; // context template $myField = $fields->get($field); $contextTemplate = $templates->get($template)->fieldgroup; $myFieldInContext = $contextTemplate->getFieldContext($myField); $case = $myField->viewable()? '' : ' not'; // optional arguments: 1 = page, 2 = user $message = "Field $field is$case viewable."; if (!$contextTemplate->has($myField)) $message .= " Field $field is not part of template $template."; else { $case = $myFieldInContext->viewable()? '' : ' not'; // optional arguments: 1 = page, 2 = user $message .= " Field $field is$case viewable in context with template $template."; } var_dump($message); 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now