0

I want to let the author to specify whether node update date should be visible to visitors or not, per node (not node types) with a checkbox at node insert/edit form?

Update: I know how to use fields but I considered using something other than a new field. Something like variables.

Because I just want to save a simple Boolean value and I think fields will push an unreasonable overhead to Drupal for such a simple task.

1

I think using the Flag module could be a solution for this. A "Flag" is like a variable, and boolean (it is turned on or off, or set or unset). In this case a flag to indicate either "Visible to vistors" or "Hidden to visitors".

Probably combined with the Rules and the Content Access module. So that when the author SETs the flag to "Visible to vistors" (= The event used in the "Rule"), then via Rules you trigger an "action" to grant access to "the entire node" for anonymous users (if that is what you'd want to do).

If however the author should only be able to specify if visitors can yes or no see the update date of the node (so not to make the entire node yes/no visible), then these refinements/variations apply:

  • Refine the meaning of the flag, something like "Update date visible to vistors", versus "Update date hidden for vistors".
  • Use the Field Permissions module to grant access to the "update date" fields.
  • If flagged as "Update date visible for vistors", then via Rules you trigger an "action" to grant field level access to "update date" for anonymous users also.

If you think like "hm, 3 modules instead of just using 1 extra field?", then think twice ... And note that this approach gives you so much more funtionality. Moreover, modules like Flag and Rules should be part of mostly any site (there are so much usecases for them ...).

2
  • My question isn't about make entire node visible or invisible. I want to let author specify if visitors should see the update date of node or not, per node. I think your solution addressing the entire node. Jul 14 '15 at 18:40
  • I extended my answer related to "update date" only (instead of entire node) ... Jul 14 '15 at 19:09
2

You could add new field as a checkbox author check if he needs the update date visible to visitors.

Use panels and page manager to build a custom page view for that node type

Add visibility rule to display the update date if the checkbox field is checked

2
  • Thank you. I know how to use fields but i considered using something other than a new field. Something like variables? Because i just want to save a simple Boolean value and i think fields will push an unreasonable overhead to Drupal. Jul 14 '15 at 9:09
  • Variables will be stored in the DB also if you used variable_set/get Jul 14 '15 at 10:01

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.