Changing the labels for Node Referrer fields cause them to disappear
| Project: | NodeReferrer |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Situation:
I am making a music directory (of bands, promoters etc) which has a core content type of "directory listing". I am also inserting events, reviews and interviews into the site, each of which has a content type associated such as "review", "event".
In each of the reviews, events, interviews etc I have inserted a node REFERENCE field so that when a user is writing a review they can select the subject of their review from the events listed on the site. I have also changed the label on these node REFERENCE fields to more human titles (e.g. "Subject of Review" rather than "nr_review_dir_ent"). This all works fine.
The directory entries want to have links back to each of these so that when you navigate to the directory entry for a band or promoter there is a list of the events, reviews etc pertaining to them.
To do so I inserted multiple node REFERRER fields into the "directory listing" content type - each one listing the nodes of each content type (e.g. events, reviews) which link to that directory listing.
Problems:
1.) I don't know if this is strictly a bug / problem, but it took me a while to figure out that this was why my node REFERRER fields weren't showing up, and it seems like something that should be coded into the module: When a node REFERRER field is added to the "directory listing" content type it does not show up on any actual nodes UNTIL the cache is cleared manually with the Devel Module.
So if I add a node REFERRER field to list the events which that band are playing at - it's invisible until the cache is manually cleared. Then it appears. Perhaps the module itself could clear the cache when an operation which requires it is carried out?
2.) This is the biggie: When the LABEL for the node REFERRER field is changed in "content type > manage fields" (from something like "nrs_dir_ent_events" to "Upcoming Events") then everything seems fine - and when you do a browser-refresh on the directory entry node the label has changed as it should - BUT - when the cache is next cleared that relabeled node REFERRER field disappears from the directory entry node. It is still listed in the "manage fields" list inside the "directory entry" content type - but doesn't appear in any of the "directory entry" nodes.
If you change the label back to what it was and clear the cache again it doesn't fix it. It stays missing from the directory entry node. I have found no way to get it back - the only solution is to create another one and then delete the previous one... then clear the cache again.
This ultimately leaves me in the situation where all the node REFERRER fields for events, interviews etc. can't be given a suitable title, and instead have to retain the machine-readable default name which they were given upon creation. If I change it, they disappear.
Any ideas? I'm quite new to Drupal so I thought I'd flag it up here first in case it was an obvious thing in the code where a label is substituted for a machine-readable id or something and could be solved very quickly. Has anyone else experienced this?

#1
I couldn't reproduce this on a clean install of Drupal 5.7 with just CCK and node referrer module installed, I did find that I needed to clear cache to get my second node referrer field to appear on the node. Can you confirm you can reproduce on a clean install?
#2
Oh, I've noticed that if you change the label WHILE creating the field it works fine - it's only if after the field is created that you change the label that it disappears (post cache clear).
I'm sorry I can't try it on a clean install right at the moment, but as soon as I have time I will try it!
#3
Ok, we replicated it on a fresh install. CCK, node reference, node referrer and Devel modules installed.
Set up a content type "directory_entry", then give it a node reference field - i called mine "node_reference".
Create a couple of instances of this content type, "one" and "two", then insert "two" in the node reference field of "one" and vice versa. Basically you want each node to reference the other (in practice reciprocal linking isn't necessary to cause the bug, but this is the fastest way of setting up a scenario to see it happen).
If you look at the node for "one" you should see a link to "two", and vice versa. These links appear under the "node_reference" field heading.
Now, edit the content type and insert a node referrer field. Enter a machine-readable name - I chose "node_referrer". Set the referrer field to list the "directory_entry" content type.
Now navigate to a directory entry node and empty the cache!!!
You should then see both fields on the directory entry nodes ( http://brokebust.googlepages.com/node_referrer_bug_001.jpg ) - everything so far seems fine.
Now go into "content type > manage fields" and change the label of the field "node_referrer" to "Node Referrer" (or anything else).
Go to one of your directory entry nodes and press browser refresh (DO NOT CLEAR CACHE) - you should now see that it seems to have worked ( http://brokebust.googlepages.com/node_referrer_bug_002.jpg ) - everything so far seems fine.
Now navigate to a directory entry node and empty the cache!!!
Now you should see that the node referrer field disappears in front of your eyes ( http://brokebust.googlepages.com/node_referrer_bug_003.jpg ) - everything is not fine!
NOTE: Like I said in my previous post if you alter the label during the creation process then it allows that, but obviously if you then need to change it later it will bust itself just as described above.
Any help would be appreciated as I'm fairly certain now that this is a "bug". Cheers!
#4
Right - a friend has found a solution.
This bug only occurs if you fail to set the "Referring Fields" within the Node Referrer field settings.
So it seems like the real problem is that you are allowed to leave these fields blank - and it will still work until the cache is emptied.
Thanks for the help!