In the node table, status 0 means unpublished; status 1 means published.

In the comments table, status 0 means published; status 1 means unpublished.

Shouldn't we be consistent?

Comments

ax’s picture

Component: comment.module » base system

definitely. consistent - and readable. for the sake of readability, we should really use constants for any similar ... constants.

ie.

node.module:
define('NODE_STATUS_NOT_PUBLISHED', 0);
define('NODE_STATUS_PUBLISHED', 1);

comment.module:
define('COMMENT_STATUS_NOT_PUBLISHED', 0);
define('COMMENT_STATUS_PUBLISHED', 1);
define('COMMENT_STATUS_DELETED', 2);

(see 'Status' field values for nodes and comments)

and you would never need to break your head about what that 1 was again ...

any volunteer? :)

Uwe Hermann’s picture

While I think having these constants is a good idea, that still leaves the problem of confusion when you hand-edit your database tables. In the database you still only read 0, 1 and 2 and not any readable names...

Another problem is the upgrading of Drupal installations, which needs to be done properly, or else many sites will have wrong values in their database...

sofiya’s picture

Component: base system » comment.module

im following this up. for consitency, can these two lines in comment.module:

define('COMMENT_PUBLISHED', 0);
define('COMMENT_NOT_PUBLISHED', 1);

be inter/changed to:

define('COMMENT_PUBLISHED', 1);
define('COMMENT_NOT_PUBLISHED', 0);

and in the upgrade script:

update comments set status=0 where status=1;
update comments set status=1 where status=0;
jvandyk’s picture

The following noncore modules (in addition to core) would need to be changed as they use the status field of the comment table:

authorise/patches/tree.patch
commentrss/commentrss.module
devel/generate/generate-content.php
notify/notify.inc
quote/quote.module
spam/optional/comment.module.patch
spam/spam.module
trip_search/trip_search.module
workspace/workspace.module

Zen’s picture

Status: Active » Closed (fixed)

These changes have gone through :)

-K