Closed (fixed)
Project:
Node access node reference
Version:
6.x-1.10
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Apr 2011 at 22:22 UTC
Updated:
27 Jun 2011 at 23:51 UTC
I just deleted a node reference field on which I had previously specified some nodeaccess_nodereference settings. When I did that and then tried to view the content where the field was, was getting heaps of errors about the underlying now-deleted field's table being not there. I had to go into the variable in the variables table and clean up the now no-longer valid bits of data. I'm thinking this should be done automatically when a node reference field is deleted, no? Looks like you need a hook nodeaccess_nodereference_content_fieldapi($op, $field) to do the cleanup when $op is 'delete instance'. Probably just something like...
function nodeaccess_nodereference_content_fieldapi($op, $field) {
if ( $op == 'delete instance' ) {
$data = variable_get('nodeaccess_nodereference', array());
if ( isset($data[$field['type_name']][$field['field_name']]) ) {
unset($data[$field['type_name']][$field['field_name']]);
variable_set('nodeaccess_nodereference', $data);
}
}
}Shawn
Comments
Comment #1
danielb commentedGood point I'll get onto that in a few weeks. Don't have internet/phone atm.
Comment #2
danielb commentedI'm assuming in Drupal 7 it will be something like this
Comment #3
danielb commentedComment #4
danielb commentedJust to further whittle away that array I'm going to add this
Comment #5
danielb commentedComment #6
danielb commentedI reckon we need an update or something to clear out the old ones as well.
Comment #7
danielb commentedThe drupal 6 update code would be:
Comment #8
danielb commentedComment #9
aCCa commentedThanks update code worked for me (D6).