After import data, comment changes to disable although I have set default comment setting to read/write on forum type and permission to allow any body to comment.
During the setup, there is no option to choose whether or not to allow comments, so must be some default configure in this module.
how can set comment permission to anybody.

any advice, thanks.

CommentFileSizeAuthor
#12 node.inc comment patch918 bytespeterpoe

Comments

rimma’s picture

Title: a issue on fourm type » an issue on fourm type

I just find this issue no just for forum type but possibly for all content types.
this module set comments to disable, no matter what your original setting.
I try to change from the database, but even i set from database table, it still does not work.
what is problem? it is bug?
hopefully , somebody knows.
Thanks.

rimma’s picture

Title: an issue on fourm type » an issue on forum type
rimma’s picture

Title: an issue on forum type » an issue about comment disable

any idea, I greatly appreciate.

rimma’s picture

Title: an issue about comment disable » an issue about comment disable. Help Please!
Priority: Normal » Critical
rimma’s picture

Priority: Critical » Normal

I find a way to do that is update my table column from database.
but I do not how to do that from node import module.

taqwa’s picture

i need this as well

taqwa’s picture

Priority: Normal » Critical
BradM’s picture

just noticed this too, imported over 1000 nodes that have disabled comments.

I have limited access to the tables via the database module, so I managed to switch comments back on by using the 'query database' option. Note, if you choose to use the example below, do so at your own risk! Backup your tables!! Modifying tables in this manner scares the **** out of me...but like I said, it worked for me.

I have a node type set up as "tvseries" -- first I entered this in the query window:

select * FROM node where type='tvseries'

This then told me that I was dealing with the correct data -- all comments were set to "0". Essentially 'Disabled' = 0, 'Read only' = 1 and 'Read/Write' = 2.

Then, I entered this in the query window:

UPDATE node SET comment=2 WHERE type='tvseries';

Bam, all my tvseries nodes are now set to 2, meaning people can leave comments. Whew.

rimma’s picture

Thanks BradM.
I do a similar way as you.
just update all nodes to make comments available.

platypus media’s picture

Just updating the nodes is not a feasible answer when importing large quantities of data.

BradM’s picture

I know it may be a pain but it doesn't matter if you're importing 1 or 10000 nodes. The query does it all for you.

peterpoe’s picture

Status: Active » Needs review
StatusFileSize
new918 bytes

Here is a patch to import comment options. I have mildly tested it with both valid and unvalid data, but it's fairly simple so it shouldn't give any problem.

rimma’s picture

Hi Peterpope,

Thank you for your patch.

I will try it later for a big database.

thanks.

rima

Robrecht Jacques’s picture

Status: Needs review » Fixed

I've added a new support file: comment.inc which will be included when comment.module is enabled:

/* $Id$ */

/**
 * Implementation of hook_node_import_fields().
 */
function comment_node_import_fields($type) {
  $fields = array();
  if (user_access('administer nodes')) {
    $fields = array(
      'comment' => t('Node: Comment options'),
    );
  }
  return $fields;
}

/**
 * Implementation of hook_node_import_prepare().
 */
function comment_node_import_prepare(&$node, $preview = FALSE) {
  $errors = array();

  if (isset($node->comment) && !empty($node->comment)) {
    // TODO: find a way to use the comment constants COMMENT_NODE_DISABLED/READ_ONLY/READ_WRITE
    if (!is_numeric($node->comment) or ($node->comment < 0 || $node->comment > 2)) {
      $errors[] = t('The comment option %comment is not a valid option. Valid options are: 0 (disabled), 1 (read only), 2 (read/write).', array('%comment' => $node->comment));
    }
  }
  else {
    $node->comment = variable_get('comment_'. $node->type, COMMENT_NODE_READ_WRITE);
  }

  return $errors;
}

This implements the same functionality as the patch provided.

Committed to DRUPAL-5 branch. It will be included in the next release (5.x-1.3). Thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

alexmoreno’s picture

wonderful. In my situation i had problems with feedapi (now feeds) and nodecomments. Importing using Feeds results in nodes with comments disabled... great review web without reviews possibility, don't you think? :-)

solution:

UPDATE node SET comment=2 WHERE `type` LIKE 'type_of_content'

thanks a lot :-).