I setup a View of CCK nodes 'recipes'. Anonymous users can add recipes, but the View doesn't show the newly added recipes. If I go to admin/content/types/recipes/access, and click submit without changing any settings, only then will the View reflect the newly added recipes.
Any ideas why? It's quite cumbersome to have to do that all the time so that the View displays all nodes of type recipe.
Many thanks,
Comments
Comment #1
masipila commentedHi,
this sounds like a caching issue more than a Content Access issue. I guess that loading admin/content/types/recipes/access invalidates the cache and thus has a side effect of refreshing your recipe view.
If this is the case you know this is a caching problem. You'll have a couple of options:
Drupal handles anonymous users and logged in users very differently when page caching is turned on. When it is turned on the whole pages are stored to cache_page database table and served from there to anonymous users. The cached page will be eventually replaced with a new version but it will take its time.
If that is not acceptable and you are familiar with PHP programming you can write a tiny little helper module that implements function hook_nodeapi. When a node of type 'recipe' triggers 'insert', 'update' or 'delete' operation your module would clear the cache of that URL where your view is being displayed on. Cache items can be invalidated with function cache_clear_all. In this case you would give cache_clear_all two parameters; the $cid argument would be the URL of the page you want to invalidate and $table would be 'cache_page'.
If you decide to create your own module and you haven't programmed modules before there is a Module developer's guide to get you started.
Hope this helps.
Comment #2
ellanylea commentedYes, you're right, it was a page caching problem. I've noticed that if I run cron.php, the content refreshes...
Your explanations have been incredibly helpful, thank you so much!