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 577825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:11:42+00:00 2026-05-13T14:11:42+00:00

I have constructed a set of nodes. After running them through node_save() , I

  • 0

I have constructed a set of nodes. After running them through node_save(), I get back an nid, and I can navigate to the page for that node, but they are empty. (No data is shown for any of the fields.)

When I go to the edit url for that node, I get this error message:

warning: call_user_func_array()
[function.call-user-func-array]: First
argument is expected to be a valid
callback, ‘Bout_node_form’ was given
in
/home/odp/public_html/includes/form.inc
on line 367.

Here is the print_r() of one node I am trying to save:

stdClass Object
(
    [type] => Bout
    [name] => Gary Oak
    [title] => Bout - 0
    [promote] => 1
    [comment] => 2
    [revision] => 
    [format] => 0
    [status] => 0
    [field_weapon] => Array
        (
            [0] => Array
                (
                    [value] => foil
                )

        )

    [field_fencer] => Array
        (
            [0] => Array
                (
                    [uid] => 3
                )

        )

    [field_touches_scored] => Array
        (
            [0] => Array
                (
                    [value] => 4
                )

        )

    [field_meet] => Array
        (
            [0] => Array
                (
                    [nid] => Drew
                )

        )

    [field_round] => Array
        (
            [0] => Array
                (
                    [value] => 1
                )

        )

    [field_legacy_bout] => Array
        (
            [0] => Array
                (
                    [value] => no
                )

        )

    [teaser] => 
    [uid] => 1
    [created] => 1262732370
    [validated] => 1
)

These nodes have all been run though node_validate(), and presumably that would have caught some errors. Also, this node is missing required taxonomy, but that isn’t causing any error messages, either.

This is how node_validate() was called:

function preview_validate($form, &$form_state) {
    $nodes_to_save = construct_nodes();

    foreach ($nodes_to_save as $node) {
        node_validate($node, $form);
        if ($errors = form_get_errors()) {
            form_set_error('', t('Validation error. No nodes saved.'));
        }
    }

    $_SESSION[CONSTRUCTED_KEY] = $nodes_to_save;
}

This is where the error is coming from, in the core file includes/form.inc:

  // If $callback was returned by a hook_forms() implementation, call it.
  // Otherwise, call the function named after the form id.
  $form = call_user_func_array(isset($callback) ? $callback : $form_id, $args);

The node shows up in the node table, but not the content_type_bout table.

This is the construct_nodes() function:

function construct_nodes() {
    global $user;
    $file = unserialize($_SESSION[FILE_KEY]);

    $count = 0;         // how many nodes have been created?
    $success = TRUE;    // have all the nodes thus far validated?
    foreach ($file->parsed as $node) {
        $odp = new StdClass();
        $odp->type = $_SESSION[NODE_TYPE_KEY];

        if (! in_array('name', $file->matched_keys)) {
            $odp->name = $user->name;
        }

        if (! in_array('title', $file->matched_keys)) {
            $odp->title = sprintf("%s - %s", $_SESSION[NODE_TYPE_KEY], $count);
        }

        $node_type_default = variable_get('node_options_'. $_SESSION[NODE_TYPE_KEY], array('status', 'promote')); //copied from blogapi module

        $odp->promote = in_array('promote', $node_type_default);
        $odp->comment = variable_get('comment_'. $_SESSION[NODE_TYPE_KEY], 2);
        $odp->revision = in_array('revision', $node_type_default);
        $odp->format = FILTER_FORMAT_DEFAULT;
        $odp->status = CTN_DEFAULT_PUBLISHED;

        // this makes the assumption that the field arrays will always have only one item
        // doesn't handle taxonomy
        foreach ($node as $field => $value) { // $field => value:                           [Touches scored] => 5
            $node_key = $file->matched_keys[$field]; // $node_key will be something like:   "field_meet" or "vid:4"
            $vid = vidOfTaxKey($node_key);
            if ($vid == NULL) {
                $valTypes = $_SESSION[SAMPLE_NODE_KEY]->$node_key; // like:     [0] => Array ( [uid] => 3 )
                $valType = array_keys($valTypes[0]);
                $odp->$node_key = array(array($valType[0] => $value));
            }
        }

        $to_save[] = $odp;
        $count++;
        unset($submitted_odp);
    }
    return $to_save;
}

bout is a CCK-defined content type. Using the human name “Bout” for the type instead of the internal code name bout was, I believe, a source of error.

  • 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-13T14:11:43+00:00Added an answer on May 13, 2026 at 2:11 pm
    1. where is this custom content type defined? in a custom module, or via Administer > Content > Content types > Add content type? is it defined at all? if not, then no wonder you get this error: how is Drupal supposed to know what this content type is composed of and how to render its view and edit forms? try defining it, either way.

    2. custom content (node) type names ([type] => Bout) must contain only lowercase letters, numbers, and underscores. try changing Bout to bout.

    see also How do I create a node from a cron job in drupal? and http://drupal.org/node/178506#comment-895418 (the whole thread).

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

Sidebar

Related Questions

I have set up a circular linked list data structure that represents a word,
I feel like I'm missing something very simple here. I have Eclipse set up
Thanks to some very helpful stackOverflow users at Bit twiddling: which bit is set?
I am constructing enum values that have a data structure like the following: enum
I try to map a relation for the first time. I have found a
right now in my $.ajax({ ..}); call I have the following option: data: {
class TimeObject { DateTime time; bool isMatinee; } Given: {8:00, 9:30, 11:00, 12:10, 2:00,
This question is similar to this one: LINQ to SQL: GroupBy() and Max() to
I did just come up with the following idea, but I lack the knowledge
I'm facing some architectural problems on the project I'm involved in. The project is

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.