I have a view that is being rendered, via a block, that is a summary/tally of records. It has a different output according to whether in Preview mode of Views, or live.
Live:
Preview:
The contextual filter returns the TID.
Block rendering code:
<?php /** * @file * Template for outputting the default block styling within a Layout. * * Variables available: * - $classes: Array of classes that should be displayed on the block's wrapper. * - $title: The title of the block. * - $title_prefix/$title_suffix: A prefix and suffix for the title tag. This * is important to print out as administrative links to edit this block are * printed in these variables. * - $content: The actual content of the block. */ function gettid(){ global $user; $tax= taxonomy_get_tree('vhb_team',0,3,true); foreach($tax as $k=>$v){ if(isset($v->field_userid['und']) && isset($v->field_userid['und'][0])){ if(isset($v->field_userid['und'][0]['uid']) && $v->field_userid['und'][0]['uid'] == $user->uid){ if(isset($v->tid)){ return (int)$v->tid; } else { return false; } } } } } ?> <div class="block block-block-vhbtop4a"> <?php print render($title_prefix); ?> <?php if ($title): ?> <h2 class="block-title"><?php print $title; ?></h2> <?php endif; ?> <?php print render($title_suffix); ?> <?php if(gettid()){print"TID=".gettid();} $rend=views_embed_view('roles','openingsblock_tally'); //$rend2=views_embed_view('organisations_exportable','archived_orgs_block'); // views_embed_view //The first option is the machine name of the view, this is found if you hover over the edit link on the views page and look at the link address. The second is the block or page machine name, so if its the first block it would be block_1 or block_2. This is found in the view under the "Other" list. if(!empty($rend2) || !empty($rend)){ print render($rend); } ?> </div>
There are in fact 39 records that shows the Preview to be correct. Why is the live block rendering wrong?
Ok, so I found the source of the issue, and it is the draft content from one of the other threads; the team member cannot get the draft content within views, the admin can.
I will continue in that thread, as I have an idea of how to diagnose this...