How to update cck field when adding nodes by code

Hello,

I wrote a function so I could quickly add nodes by code.
Basically it builds a $node object and then uses node_save().

Everything is good until I try to add values to cck fields for that node... no success.

What I need is:
I have a cck field called 'subtitle' which I want to get an automatic value (based on node's title) when
the user adds a new node.
(I tried looking at the macro engine and use something like $node['field_subtitle'][0]['value'] = "something" but no luck)

Here is the function I am currently using to add nodes (I extracted it from the blogapi.module):


function lt_add_node($title,$type,$content,$userid,$username) {

$url = $title;

// Add the node
$edit = array();
$edit['type'] = $type;
// get the node type defaults
$node_type_default = variable_get('node_options_'. $edit['type'], array('status', 'promote'));
$edit['uid'] = $userid;
$edit['name'] = $username;
$edit['promote'] = in_array('promote', $node_type_default);
$edit['comment'] = variable_get('comment_'. $edit['type'], 2);
$edit['revision'] = in_array('revision', $node_type_default);
$edit['format'] = FILTER_FORMAT_DEFAULT;
$edit['status'] = 1;
$edit['title'] = $title;
$edit['body'] = $content;

$edit['taxonomy'] = array('tags' => array(1 => 'Unsorted', 136 => ''));

Error on import: The translation file xxxxx.xx contains a syntax error on line xxx

Every time I try to import a translation file I'm working with -- purely for customizing some of the stiff default language -- I get the above error message. Here's the lines its referencing:

#: modules/comment/comment.module:1596
msgid: "you can't post comments" [[This is the line causing the error]]
msgstr: "You must be a paid subscriber to comment on the Lowdown. %login or %register now."

I'd assumed that it was due to the apostrophe, and tried putting a \ in front of it, but to not avail. Ideas?

_book_get_depth() error in export_docbook module

I have successfully installed Drupal 4.7 locally with the intent of using it within my department at work for collaborative authoring of a small book.

Today I began testing the book features, particularly adding some dummy text and attempting to create some output using the export_docbook module.

When I attempt to do so, I receive the following error:

Fatal error: Call to undefined function _book_get_depth() in C:\wamp\www\cms\modules\export_docbook\export_docbook.module on line 58

Drupal 4.7.x Themes

Is anybody still downloading Drupal 4.7 Themes?

Test site not working

Hello,

I'm preparing to upgrade my 4.7 site to 5.0, and wished to replicate my live site

I've:

I think Drupal may match my needs but I have a question about versions...

Drupal just might be the perfect software for me, however I have a few questions:

Why are you releasing version of 4.x and 5.x simultaneously? I'm assuming that perhaps this was just a security patch and for some strange reason you still support the 4.x software? But 5.x is the latest, best, and most stable release?

And my second question, if I'm in the process of creating a site should I wait for Drupal 6.x? How far off is it? Could I just use the current RC or is it not stable enough? Could I just use 5.x and easily upgrade to 6.x?

Pages

Subscribe with RSS Subscribe to RSS - Drupal 4.7.x