Few days ago, I started using maxlength on one of my projects.
everything worked great.
Then, I changed the autonodetitle setting on one of my content types, and saved the content type.
Something about saving the content type, changed some data in the db related to maxlenth and this snippet of code below stopped working. Note, the code worked with maxlength enabled and in use regarding a different content type... just stopped working after saving something (doesn't have to be autonodetitle) about this content type. Disabling maxlength and uninstalling it, makes the code snippet work again.

function cker_addworkshop(){

        require_once './includes/bootstrap.inc';
        drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

        $form_state = array();

        module_load_include('inc', 'node', 'node.pages');  // new for Drupal 6

        $nodeTmp = array('type' => 'attendee_session_choice'); // a variable holding the content type

        $form_state['values']['type'] = 'attendee_session_choice'; // the type of the node to be created
        $form_state['values']['status'] = 1; // set the node's status to Published, or set to 0 for unpublished
        $form_state['values']['title'] = 'Attendee Session Choice';   // the node's title
        $form_state['values']['body'] = ''; // the body, not required - whatever body you might want, or else, leave blank

         // the username of the node's author, must be a valid user with access to create this node.
         // Otherwise, see (http://drupal.org/node/178506#comment-726479) above about using user_load() to create nodes as any user, even
 when not logged in
        $form_state['values']['name'] = 'me';  // TODO: Get logged in user name
        $form_state['values']['op'] = t('Save');  // this seems to be a required value
        $form_state['values']['field_choice_attendee'][0]['nid'] = arg(1);  //  Get attendee nid
        $form_state['values']['field_choice_workshop'][0]['nid'] = arg(3);  // Get workshop nid
        $form_state['values']['field_choice_rank'][0]['value'] = arg(4);  // fivestar rating field TODO: Get selected star

         // call the function to create the node, node_revisions, and CCK values.
         // Replace "story" with the name of your form / content type
        $errs = drupal_execute('attendee_session_choice_node_form', $form_state, (object) $nodeTmp);

          // if there were any validation errors, drupal_execute will return them, then you have a chance to do something
        if (count($errs)) {
                echo "There were errors creating the node<br>";
        }

Is there something I should fill in the array to fool maxlength into working when creating a node like that?

Comments

cedewey’s picture

Status: Active » Closed (won't fix)

The Drupal 6 version of Maxlength is no longer supported so I'm marking this Closed (won't fix).

I also encourage you, if you haven't already, to upgrade your site to Drupal 8/9. We are actively maintaining that version and you would enjoy all of the other features of the latest version of Drupal.