template file output (unformatted row style) differs based on role

Events happening in the community are now at Drupal community events on www.drupal.org.
ben.hamelin's picture

I have created a template file (views-view-unformatted--event-search--block-6.tpl.php) to control row output.
Row style is fields, style unformatted (see TPL name) and grouped by an ID field, which is shared by nodes in the view.

This is an events search where each node represents a single day occurrence for a given event, but event details are shared, hence the shared ID field.

My goal was to use the first and last day occurrence dates to build one output "row" that would contain both dates, and suppress any other results within that group.

I was able to accomplish this within the template file identified above, where I modified the foreach loop over each row to inspect the entire rows array, and customize my output from there. This was working fine, and in short, looked something like this:

$result1 = $rows[(count($rows)-1)];
$result2 = $rows[0];

// some string processing to pull out date values and build the final row

However, when I reviewed the new output as anonymous user, I did not see the entire view result.
After investigating further, what I discovered was that the template file was running/invoked FOR EVERY UNIQUE GROUP when I was logged in as USER 1, but otherwise only run ONCE for each other user, including anonymous.

I am in the process of adjusting my code to handle this, however I am intrigued as to why this is happening, and whether this is a Views specific condition or whether this is more of a theming engine issue.

Any insight would be greatly appreciated!

bh

Comments

Theory regarding fields and perms

ben.hamelin's picture

After working on some similar scenarios I have an idea on what might be happening.
The field I was using to group by was a "hidden" field, which did not have view permissions assigned to any roles.
As user #1, I think because I had perms to view that field, that the output rendered differently. That's all I have, again, just a theory, but starting to think that is at least part of the issue.

I think a bit more research into the phptemplate theming engine might get me some more info.

Views Developers

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: