I downloaded the latest version of cck from cvs and installed it. After doing the database update and adding a new content type, I attempted to add a field to my new content type.

[Sun Jun 18 09:41:54 2006] [error] PHP Fatal error: Call to undefined function content_fields() in /Library/WebServer/Documents/mysites/roachmusic/modules/cck/weburl.module on line 196

I rolled back to version 4.7 and everything seems to work fine.

Comments

robert.redl@easytouch.cc’s picture

someone threw it out from CCK 4.7up to CVS.
I also use somepatches that need _content_fields. Should be in the cvs version shortly I hope...

In the meantime, add the following function to the end of
modules/cck/content.module

/**
* Return a list of all fields.
*
* @param $reset
*  If TRUE, clear the cache and fetch the information from the database again.
*/
function _content_fields($reset = FALSE) {
  static $fields;

  if ($reset || !isset($fields)) {
    $fields = array();
    $field_result = db_query('SELECT * FROM {node_field} nf');
    while ($field = db_fetch_array($field_result)) {
      $global_settings = $field['global_settings'] ? unserialize($field['global_settings']) : array();
      unset($field['global_settings']);
      $field = array_merge($field, $global_settings);
      $instance_info = db_fetch_array(db_query("SELECT type_name, label FROM {node_field_instance} WHERE field_name = '%s'", $field['field_name']));
      $field['widget']['label'] = $instance_info['label'];
      $field['type_name'] = $instance_info['type_name'];
      $fields[$field['field_name']] = $field;
    }
  }

  return $fields;
}
karens’s picture

The function _content_fields was renamed content_fields in cvs, so 4.7 version of the content module uses _content_fields and the cvs version uses content_fields. This just changed and there was no mention of it anywhere, so most of the modules and patches flying around are still using _content_fields. The better patch would be to change cvs modules and patches to use the new function name.

David Lesieur’s picture

Status: Active » Fixed

The current weburl.module uses the new function name content_fields(), so apparently this is fixed.

Anonymous’s picture

Status: Fixed » Closed (fixed)