Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1112027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:38:34+00:00 2026-05-17T02:38:34+00:00

I am building a Drupal module that (among other things) creates multiple nodes of

  • 0

I am building a Drupal module that (among other things) creates multiple nodes of type ‘individual_match’ when a node of type ‘team_match’ is created. A team_match is a collection of related individual matches.

I used the method explained on Advomatic, which I found in an old Stack Overflow post. It works great (meaning it creates the node) but it returns a lot of error messages, all pertaining to a null date.

Here is the relevant code from the hook_nodeapi function:

    case 'insert':
      // insert individual matches when a team match is created
      if($node->type == 'team_match') {
        // Create node of type 'individual_match'
        // will be a loop, once date errors are sorted out
        $form_state = array();
        $tmp_node = new stdClass(); 
        $tmp_node->type = 'individual_match';
        // create form for new node
        $form_state['values']['type'] = $tmp_node->type;
        $form_state['values']['status'] = 1;
        $form_state['values']['title'] = $node->title;
        $form_state['values']['uid'] = $node->uid;
        $form_state['values']['name'] = $node->name;
        $form_state['values']['op'] = t('Save');  // This seems to be a required value.
        // Create the content.
        drupal_execute($tmp_node->type.'_node_form', $form_state,  &$tmp_node);
      }
    break;

And here are the error messages:

  • warning: date_offset_get() expects parameter 1 to be DateTime, null given in /var/www/vhosts/example.com/httpdocs/sites/all/modules/date/date/date_elements.inc on line 491.
  • warning: date_format() expects parameter 1 to be DateTime, null given in /var/www/vhosts/example.com/httpdocs/sites/all/modules/date/date/date_elements.inc on line 494.
  • warning: date_format() expects parameter 1 to be DateTime, null given in /var/www/vhosts/example.com/httpdocs/sites/all/modules/date/date/date_elements.inc on line 495.
  • warning: date_offset_get() expects parameter 1 to be DateTime, null given in /var/www/vhosts/example.com/httpdocs/sites/all/modules/date/date/date_elements.inc on line 497.
  • warning: date_timezone_set() expects parameter 1 to be DateTime, null given in /var/www/vhosts/example.com/httpdocs/sites/all/modules/date/date/date_elements.inc on line 498.
  • warning: date_timezone_set() expects parameter 1 to be DateTime, null given in /var/www/vhosts/example.com/httpdocs/sites/all/modules/date/date/date_elements.inc on line 499.
  • warning: date_format() expects parameter 1 to be DateTime, null given in /var/www/vhosts/example.com/httpdocs/sites/all/modules/date/date/date_elements.inc on line 500.
  • warning: date_format() expects parameter 1 to be DateTime, null given in /var/www/vhosts/example.com/httpdocs/sites/all/modules/date/date/date_elements.inc on line 501.
  • warning: date_timezone_set() expects parameter 1 to be DateTime, null given in /var/www/vhosts/example.com/httpdocs/sites/all/modules/date/date/date_elements.inc on line 509.
  • warning: date_timezone_set() expects parameter 1 to be DateTime, null given in /var/www/vhosts/example.com/httpdocs/sites/all/modules/date/date/date_elements.inc on line 510.
  • warning: date_format() expects parameter 1 to be DateTime, null given in /var/www/vhosts/example.com/httpdocs/sites/all/modules/date/date/date_elements.inc on line 511.
  • warning: date_format() expects parameter 1 to be DateTime, null given in /var/www/vhosts/example.com/httpdocs/sites/all/modules/date/date/date_elements.inc on line 514.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:38:34+00:00Added an answer on May 17, 2026 at 2:38 am

    This proved to be a required CCK datetime field on the ‘individual_match’ content type. Setting it in the function, or not making it required, solves this problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a custom module for Drupal 6, that creates a simple form. My
I'm currently building out a Drupal site that is an aggregate of local housing
I'm adding additional languages to a Drupal site that I'm building. Getting the translation
I've a problem with drupal paths in one view that I building. Right now
I am building a Drupal 6 module for a client and I want to
I am building a drupal 6 module. I want to code it such a
I'm building a Drupal module to tie an icon to a particular page using
I am building a complex AJAX based solution as a module into a Drupal
I'm currently building a chrome extension that pulls data from a Drupal 6 website,
RRULE:FREQ=DAILY;INTERVAL=1;BYDAY=TU,WE,FR;UNTIL=20110713T075959Z;WKST=SU I'm building a drupal site and the Date module outputs this code, which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.