When submitting a node without commands, comments are off, even if comments have been set to "read/write" in the content type settings page. I don't know if this is done on purpose, but i think that if the node type has comments set to "read/write" by default, submitted nodes that do not have commands should have comments enabled. I think the same applies for other defaults (status, promote, sticky).

Here is a simple fix, that should be added to mailhandler_retrieve_message, before the node is submitted :

  $options = variable_get('node_options_'. $node->type, FALSE);
  if (is_array($options)) {
    $node->status = in_array('status', $options) ? 1 : 0;
    $node->promote = in_array('promote', $options) ? 1 : 0;
    $node->sticky = in_array('sticky', $options) ? 1 : 0;
  }
  else {
    $node->status = 1;
  }

  $comment = variable_get('comment_'. $node->type, 0);
  $node->comment = $comment;

I can submit a patch if you want.

CommentFileSizeAuthor
#3 mailhandler_defaults.patch827 bytesjide
#2 mailhandler_defaults.patch943 bytesjide

Comments

z.stolar’s picture

Please submit the patch, it would be of great help!

jide’s picture

Assigned: Unassigned » jide
Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new943 bytes

Here we go ! Here is an attached patch, roughly tested.

jide’s picture

StatusFileSize
new827 bytes

Update : the code has moved to mailhandler_node_submit.

SamRose’s picture

Will this code also work with Drupal 5.x ? My tests so far seem to indicate that it will not...

SamRose’s picture

Ok, tested by inserting this into line 193 in mailhanlder.module Drupal 5.x, and indeed it does work.

jide’s picture

Good to know that it also works for 5.x. Maybe you could submit a specific patch for 5.x ?
Any update on this patch anyone ?

SamRose’s picture

Sure, I will submit a patch, I just need to a moment soon to take my other custom code out so that patch will match your work, will do ASAP

z.stolar’s picture

I just committed another patch, based on the one on #3 up here. Please test the last CVS version and tell me if it works fine for you.

z.stolar’s picture

Status: Needs review » Fixed

Please re-open if needed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.