Jump to content

Template content is only shown when logged in as admin


zynth
 Share

Recommended Posts

Hi,

I have this weird problem where my page content is only shown, when I'm logged in as an admin.

A thing worth mentioning is, that I've imported data from a site that's already online via the built-in import/export functionality.

Maybe someone here had a similar experience? I don't know how to debug this as well, since there's no errors thrown when accessing the data in the templates. It's just blank when not logged in.

When logged in:
image.thumb.png.86ea846305ef1c0dc679950618f97f54.png

When logged out:
image.thumb.png.87e5d5a9e365b5dff82afa6fc0ccbaac.png


Cheers
Dennis

Link to comment
Share on other sites

Where is Schule and Meht Erfahren coming from? Is Schule coming from $page->title? Where is the content Musik erlerenen coming from? From $page->body? Or some other field? I am asking since there could be one or more permission restrictions in place. Possible issues:

  1. You have in condition in your template file that is restricting the output of the content. It could even be a hardcoded value of a page ID that doesn't existing in your import site. I.e., in the export site, SOME_PAGE might have the ID 1234 which when you import in your local/other site is saved as SOME_PAGE with ID 1255.
  2. You have a field-level view restriction. Especially if only the content of one field is not showing, I would focus on this.
  3. You have template-level view restriction. This means that SOME_PAGE utilises 'some-template' which has view restrictions.

Is this happening on all the pages? Is it happening on pages that use different templates?

Link to comment
Share on other sites

Hi @kongondo,

"Schule" and "Mehr erfahren" are just hard coded values in my template. The template here is called home and the field we're looking at is a repeater field (back then I didn't know that Fieldset elements existed.)

The repeater field has two fields - ttile and paragraph. Those are the fields that come from the database. In my template, I access the repeater field via:

$page->schule_home[0]

Also there's no restrictions set on the template or the repeater field.

The problem also occurs on other page templates...

Link to comment
Share on other sites

I've found the issue..

image.png.73b29c10f0e5517daaaff1da774bbade.png

 

The field that was being used in the repeater had access control enabled, but guest had view permissions. I turned it off, and now it works again. Can you explain why it didn't work, even though guest had view access?

 

Cheers, Dennis

Link to comment
Share on other sites

Maybe because of this?

permission_control_field_in_repeater.thumb.png.7d36d3d15d5747c3ea536cb7bab78e72.png

Repeaters are admin pages. Guests do not have view access to repeater pages (page where the field exists), hence, even though guest had view permission, they still couldn't view the field since it lives in a restricted area (repeater). In other words, their view permission was not 'applicable'.

Edited by kongondo
Link to comment
Share on other sites

54 minutes ago, zynth said:

Although that makes me wonder, how you're supposed to use both these features together?

EDITED

It should work for 'usual frontend' pages. Since non-super users will have view permission for such pages. The added layer of restriction with respect to repeaters wouldn't apply. Hope this makes sense. For instance, if you had a 'members' field that is only viewable to 'members', logged in members (non-superusers) will be able to see the field as long as that field was on a page that members have page view or edit access to. Meaning, if that page is not a child of an admin page (e.g. repeaters, etc), the permission set will kick in. 

Edited by kongondo
clarification
  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...