In admin/content there is the "status" filter which by default gives us:

not published
not promoted
not sticky

I can see that these map directly to the node table in the database:

mysql> select nid, status, promote, sticky from node;
| nid | status | promote | sticky |
|   1 |      0 |       0 |      0 |

Is there a way to add a 4th boolean column? For example important so in the filter I get important and not important and also in the Publishing options of node/1/edit I also get a checkbox "Important node".

I've seen the http://drupal.org/project/flag project but I want something simpler which will apply this information on the node table. Is it possible?

  • 1
    Use CCK to add new field. – niksmac May 3 '12 at 16:14
  • 3
    "apply this information on the node" definitely sounds like CCK, but the Flag module was created (and is heavily used) for situations just like the one you're describing. – Johnathan Elmore May 3 '12 at 16:20
  • OK but is it possible to add this as a new column on the node table? Would this be a very "hacky" way to solve this? – cherouvim May 4 '12 at 5:16

I think the Custom Publishing Options module is exactly designed for your needs.

This module allows you to create custom publishing options for nodes. It allows you to add to the default options of Publish, Promote to Front Page, and Sticky. It also ingrates with views to allow you add as a field, sort and filter by, your custom options.

It now allows each of the different options to be shown only on selected node types, as well as integration with Rules/Actions, and permissions for each option type.

| improve this answer | |
  • Module is good, just option to synch translations of nodes is missing. So it is not so useful if having i18n sites. – Marko Blazekovic Mar 16 '15 at 10:47

Flag would probably be the most 'Drupal' way to do it without writing your own module, which incidentally would be the only way to modify the node table without a significant manual hack. Although I'm pretty sure you wouldn't want to do that as it might affect the way that other parts of Drupal work.

| improve this answer | |
  • +1 for Flag. You definitely DON'T WANT to hack core tables. If you really want to do your own code, creat another table and link it to the node table with a FK and/or code. – Countzero May 8 '12 at 10:26
  • 3
    @Countzero There's no need to hack core tables, you can update them in a structured way that Drupal will respect. See drupal.stackexchange.com/a/30381 – Clive May 8 '12 at 12:12
  • OK, you're right and I learned something. Still, I think it's better to avoid messing with core tables if you can avoid it. – Countzero May 11 '12 at 14:37
  • @Countzero: Why? It just appends a column on installation and drops it on uninstall. How can this be dangerous? – cherouvim May 18 '12 at 13:41
  • 1
    I wouldn't say it's dangerous, just it is a bad habit. Perhaps I'm only a bit too sensitive about data integrity. It's more about good practice (as I intend it) than pure technical reasons. – Countzero May 21 '12 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.