This code snippet autopopulates a Computed Field CCK field for Drupal using the the functionality provided by the UUID module. Note that this is for the 6.x-1.x-dev version of the module and requires the patch attached to this comment. It assumes that you only want to generate UUIDs once. It probably should be abstracted into another CCK module, but I'm too lazy to do that at the moment.
This works similarly to the Taxonomy Defaults module, but has no UI to set this up - this is for programmatic, backend stuff. It tests to see if somethings a particular content type and then checks for the value of a given CCK field to determine the appropriate term.
The long and the short of it, for Drupal 6 - use content_insert(), which should be fired anyway but isn't. See
node_save() with CCK fields for more details. drupal_execute() is too robust for me - I just needed to import a SQL Server table with 4500+ rows quickly. Sample code after the jump, using parsecsv for PHP.
Probably ripped off from somewhere on drupal.org...
Note: This patch is now deprecated as a new version of the plugin has been released.
Because of changes in the database schema for WordPress 2.3, the Auto Delete Posts plugin does not work. I've patched it to work, but note that this patch makes the plugin only work with WordPress 2.3.
A coworker at MFPOW wanted me to generate a list of records matching certain diverse criteria from our Horizon database. I wrote the following SQL query to get the data out.
SELECT DISTINCT item.bib# FROM item, bib WHERE bib.bib# = item.item# AND item.collection NOT IN ('oh', 'icos', 'mi') AND item.location = 'icos' AND (bib.text LIKE '%audio%' OR bib.text LIKE '%video%' OR bib.text LIKE '%cassette%' OR bib.text LIKE '%tape%' OR bib.text LIKE '%recording%' OR bib.text LIKE '%film%')