When you edit an entry and change the name of a contributor, the old contributor is not deleted in the biblio_update()
hook. Thus, an orphaned contributor (which is probably misspelled) remains in the database.
It would be then desirable to remove orphaned contributors automatically, which can be done adding the query:
db_query('DELETE FROM {biblio_contributor_data} WHERE cid NOT IN (SELECT DISTINCT(cid) FROM {biblio_contributor})');
In the biblio_update()
hook, which removes contributors which are not related to a node. The same can be done for removed nodes in the biblio_delete()
hook.
Would this have an undesired side effect?
Comments
Comment #1
rjerome CreditAttribution: rjerome commentedThe reason it's not done automatically is that in some cases you may want to prepopulate or retain authors in the database in order to enhance the autocomplete capability. i.e. a university might enter all it's faculty members so that when entering a new paper, auto-complete will produce consistent results.
I could make it an option to automatically delete orphans if so desired.
Ron.
Comment #2
mlncn CreditAttribution: mlncn commented+1 for an option to delete orphaned authors automatically. Where we (some SCF sites) have all our data pulled in from pubmed, this helps us keep the data clean.
benjamin, Agaric Design Collective
Comment #3
rjerome CreditAttribution: rjerome commentedThis is now in the -dev release. Look for an option on the settings page under the "Authors" section. It is turned OFF by default.
Ron.
Comment #4
mlncn CreditAttribution: mlncn commentedFantastic! Tested and approved, heh.