CCK

Fix for Function to add taxonomy and content_taxonomy to a node object

  1. // Sample usage:
  2. $node = new StdClass();
  3. $node->type= "story";
  4. $node->title = "Hello world";
  5. $tags = array('red', 'white', 'blue');
  6. my_nodeobject_add_content_taxonomy(&$node, 1, $tags,  'create',

Function to add taxonomy and content_taxonomy to a node object

  1. /**
  2.  * Modifies a node object adding taxonomy terms and, optionally, modifying a
  3.  * content_taxonomy type field.
  4.  *
  5.  * @param <type> $node
  6.  *   A node object.
  7.  * @param <type> $vid
  8.  *   The voc

Show all IMAGE fields used in a content type to select - not working

  1.   if (module_exists('content')) {
  2.     $fields = content_types($type->type);
  3.     $fields = (array)$fields['fields'];
  4.  
  5.     $options = array('' => t('None'));
  6.     foreach ($fields as $field_name =>

Fix for change CCK field path in Rules when node is saved - use Custom PHP

  1. I put my own queries into the Custom PHP field
  2.  
  3. //this is the path to the actual uploaded to pass to the encoding.com script
  4. $_SESSION['videoup'] = '[node:field_video-filefield-filepath]';
  5.  
  6. //upd

change CCK field path in Rules when node is saved to receive the encoding.com transcoded file - doesn't change path

  1. return array(
  2.   0 => array('fid' =>'[node:field_video-filefield-fid]', 'filepath' => 'sites/default/files/transcoded/[node:field_video-filefield-filename].flv'),
  3. );

Using DATE fields on custom module

  1. function uc_otf_form_node_type_form_alter(&$form) {
  2.  
  3.   if (uc_product_is_product($form['#node_type']->type)) {
  4.  
  5.  
  6.  if (module_exists('content')) {
  7.     $fields = content_types($type->type);
  8.    

Fix for fix non-sequential cck deltas

  1. <?php  
  2.   // Basically rewrite this to get an ordered list of nid, vid, delta from the content type or field that is insufficient.
  3.   $deltas = db_query("SELECT cfgi.nid, cfgi.vid, cfgi.delta FROM co

fix non-sequential cck deltas

  1.   // Basically rewrite this to get an ordered list of nid, vid, delta from the content type or field that is insufficient.
  2.   $deltas = db_query("SELECT cfgi.nid, cfgi.vid, cfgi.delta FROM content_fie

use a CCK field to switch node templates

  1.   // ----------------------------- node templates
  2.   // $vars['template_files'] holds an array of template suggestions,
  3.   // from most generic to most specific.
  4.   // Here we add our own suggestions
sepehr's picture

Fix for Updating a nodereference CCK field using node_save()

  1. ...
  2. // Getting current reference delta.
  3. $current_delta = db_query("SELECT delta FROM {content_field_movie_node_ref}
  4.                           WHERE vid = '%d'
  5.                           ORDER BY delta DESC
  6.                           LIMIT 1", $existing_movie-
Syndicate content