I'm having an issue with view results not updating. I have a view called member_list2, which shows all users of a select few roles, and outputs their user picture and a list of any roles they have. I'm using this view 4 times on 1 page, with 4 different arguments to show groups of users in 4 different roles.
Roles: Honorary member, Member, Founding Member, Board of Directors
Initially this works fine. Then when I change the role of one of the users, eg. take Honorary role off a user, the view on my page doesn't update this change. The live preview within the views interface does however. I've cleared the views cache, disabled the caching altogether, but nothing seems to change it. The point of this view for me is to show the current set of users within set roles. However as this doesn't update when someone moves in / out of a role, that's defeating the purpose.
The way I'm embedding the view into my page is using the insert_view module which has a handy filter for this, but I've also tried embedding it with php tags, result is the same. Live preview is right, but on the page the embedded view is on, it's not up to date.
See below for the exported view, and the live preview output. Any help would be much appreciated. Not sure if this is a bug, or a support request. Have filed as a bug initially.
The view:
$view = new view;
$view->name = 'member_list2';
$view->description = 'Member List 2';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'users';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'picture' => array(
'label' => 'Member',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'exclude' => 0,
'id' => 'picture',
'table' => 'users',
'field' => 'picture',
'relationship' => 'none',
),
'rid' => array(
'label' => 'Role',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'type' => 'separator',
'separator' => ', ',
'empty' => '',
'exclude' => 0,
'id' => 'rid',
'table' => 'users_roles',
'field' => 'rid',
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'rid' => array(
'default_action' => 'ignore',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => '',
'breadcrumb' => '',
'default_argument_type' => 'fixed',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'break_phrase' => 1,
'add_table' => 1,
'require_value' => 0,
'reduce_duplicates' => 0,
'id' => 'rid',
'table' => 'users_roles',
'field' => 'rid',
'validate_user_argument_type' => 'uid',
'validate_user_roles' => array(
'2' => 0,
'11' => 0,
'8' => 0,
'10' => 0,
'7' => 0,
'9' => 0,
'3' => 0,
'6' => 0,
'4' => 0,
),
'relationship' => 'none',
'default_options_div_prefix' => '',
'default_argument_user' => 0,
'default_argument_fixed' => '',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'blog' => 0,
'poll' => 0,
'forum' => 0,
'project_project' => 0,
'project_release' => 0,
'project_issue' => 0,
'challenge' => 0,
'event' => 0,
'hockey' => 0,
'news' => 0,
'newsletter' => 0,
'page' => 0,
'story' => 0,
'treks' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'1' => 0,
'2' => 0,
'4' => 0,
'6' => 0,
'5' => 0,
'7' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_transform' => 0,
'validate_user_restrict_roles' => 0,
'validate_argument_project_term_vocabulary' => array(
'5' => 0,
),
'validate_argument_project_term_argument_type' => 'tid',
'validate_argument_project_term_argument_action_top_without' => 'pass',
'validate_argument_project_term_argument_action_top_with' => 'pass',
'validate_argument_project_term_argument_action_child' => 'pass',
'validate_argument_php' => '',
),
));
$handler->override_option('filters', array(
'rid' => array(
'operator' => 'or',
'value' => array(
'10' => '10',
'3' => '3',
'6' => '6',
'4' => '4',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'rid',
'table' => 'users_roles',
'field' => 'rid',
'relationship' => 'none',
'reduce_duplicates' => 0,
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'time',
'results_lifespan' => '60',
'output_lifespan' => '60',
));
$handler->override_option('items_per_page', 0);
$handler->override_option('distinct', 1);
$handler->override_option('style_plugin', 'table');
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'members2');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
The live query - which is showing the correct results:
SELECT DISTINCT(users.uid) AS uid,
users.picture AS users_picture,
users.name AS users_name
FROM teamipxusers users
INNER JOIN teamipxusers_roles users_roles ON users.uid = users_roles.uid
INNER JOIN teamipxusers_roles users_roles_value_0 ON users.uid = users_roles_value_0.uid AND users_roles_value_0.rid = 6
WHERE (users_roles.rid IN (10, 3, 6, 4)) AND (users_roles_value_0.rid = 6)
Comments
Comment #1
fuzzy_texan CreditAttribution: fuzzy_texan commentedComment #2
dawehnerdid you applyed the patch from http://drupal.org/node/503774
This could fix the problem.
Comment #3
fuzzy_texan CreditAttribution: fuzzy_texan commented@dereine: Thanks for the suggestion. I hadn't tried that. Just tried it then. No change unfortunately.
It does seem to be some kind of time issue though. If I wait until later in the day, sometimes the embedded view updates (regardless of the patch). Running cron doesn't effect it, neither does clearing the views cache, or turning off Views caching altogether.
Comment #4
fuzzy_texan CreditAttribution: fuzzy_texan commentedChanging to critical on the basis that the view is not outputting up to date results.
Comment #5
dawehnerI think the problem is using the insert_view, because the filter system does cache the output of the body. Perhaps you can force to not do it, but I don't know how.
Comment #6
fuzzy_texan CreditAttribution: fuzzy_texan commentedSame thing happens when I use php to embed it. Is the filter system caching the output there too?
Comment #7
fuzzy_texan CreditAttribution: fuzzy_texan commentedAlso, under the Performance option in the drupal admin menu, I have all forms of caching disabled. Shouldn't this stop the caching of the output of the body?
If not, where else can this be configured?
Comment #8
dawehnerIf you have a look at the filter_formats table you see that the php input format has set a cache = 0.
This is very strange. I think you don't ave enabled views caching in the views edit form.
Comment #9
fuzzy_texan CreditAttribution: fuzzy_texan commentedI actually noticed I did have views caching enabled. Which was odd, I'd definitely meant to have it disabled. Anyway, I disabled it, no change.
Looking at the filter_formats table, I can see PHP is set to 0 caching. Interestingly the other format used with insert_view (my main filter format for the site) has it set to 1. 1 means on? Would setting that to 0 help?
In theory, probably not since PHP embedded views have it set to 0 and aren't updating.
I've just discovered clearing the standard drupal cache (ie not the views cache) fixes the issue. But that's just a workaround really.
Comment #10
dawehnerI would really try out to set it to 0.
Comment #11
druth CreditAttribution: druth commentedAny luck with a solution on this fuzzy_texan?
I'm having the same issue - I'm pretty sure its not an issue with the views cache, but with Drupal's cache. The view updating doesn't seem to trigger a cache refresh. When i update the node whose template the view is embedded on, the view refreshes along with the node... I'm trying to find a way to prevent a block on template code from being cached, no luck so far.
Comment #12
merlinofchaos CreditAttribution: merlinofchaos commentedViews does a general cache clear when a view is saved, but this general cache clear does not include the filter cache (which would get nodes) nor the block cache (which would get cached blocks).
These clears could be added via hook_form_alter by adding an extra #submit handler to the save button.
I don't think I'd want to have Views always clear these caches when it saves, because that could add a lot of unnecessary work to a busy system. Most sites don't do this.
Perhaps insert_view module would be responsible for doing this, but that's up to the insert view author(s).
Comment #13
fuzzy_texan CreditAttribution: fuzzy_texan commented@insert_view developers:
See #12 - suggestion is this might be something Insert Views authors may be able to handle.
Thoughts?
Comment #14
Pasquallehttp://api.drupal.org/api/function/hook_filter/6