Download & Extend

Views + CCK + Secure Pages = Trouble

Project:Secure Pages
Version:5.x-1.7-beta1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (won't fix)

Issue Summary

I am having a strange intermittent problem with Views + CCK: I have a number of CCK fields that I have defined for all sorts of different node types. In the past, I was able to create views quite easily that included these custom fields (and indeed, these views including custom fields are still in use on my site). But now, when I try to add a field to a new view that I create, I don't see any of the CCK fields as options. The only fields available are the basic ones like 'Node: Title' and so on.

To make this a little more concrete, say I have a custom text field called 'Location' created through CCK. I would expect an entry for 'Text: Location' to show up under the select menu when adding a field to a new view, but this does not happen, and I can't figure out why.

Comments

#1

Project:Drupal core» Views
Version:5.7» 5.x-1.6
Component:other» Code

Changing Project to 'Views' because I was unable to set it during submission (kept telling me to select a valid component).

#2

A few more observations:

- This seems to occur only when I am editing an existing view, but not when I create a new view
- The CCK fields are also missing from the add_menus for Filters and Sort Criteria
- If I create a new view that has a CCK field, then click 'Save and edit', the field is there still, but the options for it are all blank (Name, Handler, Option, Sortable, Default Sort).

#3

Title:CCK fields sometimes not available to add to Views» Views + CCK + Secure Pages = Trouble
Project:Views» Secure Pages
Version:5.x-1.6» 5.x-1.6

OK, so I finally figured out what is going on here. It seems this is a three-way interaction between Views, CCK, and the Secure Pages module.

What happens is this: CCK implements hook_init() in order to do an include of the file 'content_views.inc', which contains the code to expose CCK fields to Views. views_menu() calls views_load_cache(), which will regenerate the views cache if needed. Normally, this flow is fine, as hook_init() is called for all modules before hook_menu().

However, when Secure Pages is enabled, it does some funny stuff in its hook_init(), namely, it invokes the menu system in order to figure out what menu item the current path corresponds to in order to see if it should redirect. This in turn causes views_menu() to be called before content_init() has been called, so the views cache is regenerated before the code to expose CCK fields to views has been included, and thus these fields are missing.

For now, I think I am going to solve this on my site by changing the weight of CCK in the system table to make it run its hook_init() before Secure Pages, but this doesn't seem like an ideal solution. I'm not sure what the best solution in, but I figured I'd post my findings here in case others had any ideas.

#4

Subscribing.

#5

Nevermind: Issue related to 6.x not 5.x.

#6

@5: Cannot seem to spot a Nov-30 release for the 5.x branch, which one did you mean?

Edit:
Is this fixed in any of the versions available on the module page?
Can some more people chime in here with confirmation as whether this is fixed or not?

(If fixed, this issue should be closed)

#7

Sorry about that, I was having this issue in 6.x which was fixed. Not sure about 5.x.

#8

Version:5.x-1.6» 5.x-1.7-beta1

I tried adjusting the weights, but to no avail. I've tried 5.x-1.6 and 5.x-1.7-beta1. Are there any other suggested fixes?

If it helps any, I get this error message:

Unknown column 'node_data_field_image_cache.field_image_cache_fid' in 'field list' query: SELECT node.nid, node.sticky AS node_sticky, node.created AS node_created_created, node_data_field_image_cache.field_image_cache_fid AS node_data_field_image_cache_field_image_cache_fid, node.title AS node_title, node.changed AS node_changed, uc_products.sell_price AS uc_products_sell_price FROM node node LEFT JOIN term_node term_node ON node.nid = term_node.nid LEFT JOIN term_hierarchy term_hierarchy ON term_node.tid = term_hierarchy.tid LEFT JOIN uc_products uc_products ON node.vid = uc_products.vid WHERE (node.status = '1') AND (term_node.tid = '18') ORDER BY node_sticky DESC, node_created_created DESC LIMIT 0, 10 in /usr/local/www/data/www/includes/database.mysql.inc on line 172.

#9

I tried adjusting the weights, but to no avail. I've tried 5.x-1.6 and 5.x-1.7-beta1. Are there any other suggested fixes?

If it helps any, I get this error message:

Unknown column 'node_data_field_image_cache.field_image_cache_fid' in 'field list' query: SELECT node.nid, node.sticky AS node_sticky, node.created AS node_created_created, node_data_field_image_cache.field_image_cache_fid AS node_data_field_image_cache_field_image_cache_fid, node.title AS node_title, node.changed AS node_changed, uc_products.sell_price AS uc_products_sell_price FROM node node LEFT JOIN term_node term_node ON node.nid = term_node.nid LEFT JOIN term_hierarchy term_hierarchy ON term_node.tid = term_hierarchy.tid LEFT JOIN uc_products uc_products ON node.vid = uc_products.vid WHERE (node.status = '1') AND (term_node.tid = '18') ORDER BY node_sticky DESC, node_created_created DESC LIMIT 0, 10 in /usr/local/www/data/www/includes/database.mysql.inc on line 172.

#10

Has this problem been ratified? We have also encountered a similar problem in drupal 5. But to no avail.

#11

same probleme

#13

subscribing.
Great deduction benwei.

For now, I think I am going to solve this on my site by changing the weight of CCK in the system table to make it run its hook_init() before Secure Pages, but this doesn't seem like an ideal solution. I'm not sure what the best solution in, but I figured I'd post my findings here in case others had any ideas.

Did this fix work for anyone?
It didn't for me.

#14

subscribing

This bug affects us on D6 with:

CCK 6.x-2.8
Views 6.x-2.11
Secure Pages 6.x-1.8

I will attempt benwel's suggestion in this environment to see if I may re-enable Secure Pages.

At least setting the weight of sites/all/modules/cck/content.module to -10 did not fix the problem. If that was not the correct method to try benwel's suggestion then please advise.

Re-disabling Secure Pages for now. :-(

#15

Status:active» closed (won't fix)

The 5.x branch is no longer supported. If this issue is still present in a current version of Secure Pages, please update the issue summary, change the version field, and re-open the issue.

#16

Version:5.x-1.7-beta1» 6.x-1.9
Status:closed (won't fix)» active

Yes this is still a tangle between these three modules with Secure Pages 6.x-1.9.

The workaround I use is to assign to Ignore pages within the Secure Pages mod:
js/path_redirect/*

#17

Version:6.x-1.9» 5.x-1.7-beta1
Status:active» closed (won't fix)

Let's leave this closed then - path_redirect is unrelated to Views and CCK.

Regarding the path_redirect pattern, there's no way for securepages to predict what contrib module paths will need to be ignored, which is why it's presented as an admin option. There is a possibility we can mostly sidestep the issue, though: #1258200: Ignore requests with X-Requested-With:XMLHttpRequest