0

Is there a way to get the unpublished date of a node? I want the date of unpublishing of nodes to be displayed in the view in a grid.

I need it non-programmatically (ie, tweaking the UI), but if it is only available programmatically, then how do I display it in the grid view?

A total Drupal noob here. I am using D7 btw.

  • This might be the modified date in the node? – niksmac Oct 28 '15 at 4:54
  • @NikhilM "modified" holds date info of any kind of update. My node can be updated several times. I need the date of last unpublishing :( – nawfal Oct 28 '15 at 5:09
1

Create a View (using the Views module) that shows Content and displays a Grid of fields in Display format. Add the field Updated datein the list of Fields. Be sure to select Published: No in the Filter Criteria. You can add other fields if you want (e.g. Title). This will get you the date of the last update. If the node is not edited after being unpublished, the unpublished date will be the last update.

EDIT: If you specifically want to show the unpublished date, I am not aware of a module for this. I suggest another approach that is a bit circuitous, but it works. It involves creating a date field to store the unpublished date, and using Rules to set it when the node is unpublished.

  1. Download the following modules: Date and Rules.
  2. Edit your Content Type. Create a date field
  3. Create a Rule that reacts to After updating existing content of type XX. Add a condition node:status equals unpublished
  4. The Action should be set the date field value to now

That's it. Now, if you want to hide the date field in the node edit form or display, you can play around with your theme's CSS classes or explore other modules. Let me know if you have questions

  • BTW this will show the last update of the node. If someone updates it (e.g. edits it) AFTER it has been unpublished, the last edit date will be shown, as far as I know. – argiepiano Oct 28 '15 at 5:04
  • Yup you are right, this will get me updated date of the node. I think you misread me. I specifically want the date of last unpublishing :( – nawfal Oct 28 '15 at 5:11
  • See my edited answer – argiepiano Oct 28 '15 at 12:49
1

One way to do it non programmatically is through the Rules module which basically is a collection of events, conditions and actions.

For example: # Event: add event: Node: After unpublishing live content. # Condition(filters): Node: Content is of type. # Action: Set a data value.

You can set more than one condition to filter the nodes that fit your criteria best, and for the last bit maybe add an extra hidden date field for unpublication dates for rules to edit whenever the event is triggered.

  • 1
    There is no event "After unpublishing live content." See my answer for a way to get around this. – argiepiano Oct 28 '15 at 12:51
  • 1
    You are correct. I just checked and it seems that the event I mentioned is one amongst many added after the installation of the Workbench Moderation module. – Jed_BH Oct 28 '15 at 20:54
0

You can get by using these modules :

Publication Date

The Publication Date module adds a "Published on" date for each node, containing the date when it was first published.

Without this, the only dates available for nodes are their created date and changed date, but these are often insufficient to meet the needs of publishing workflows. Sorting nodes by their created date doesn't account for content which is held in draft form for a time while being readied for publication. Sorting nodes by their changed date fails to account for content needing minor corrections after being published.

view_unpublished

This module allows you to grant access for specific user roles to view unpublished nodes of a specific type. Access control is quite granular in this regard.

Additionally, using this module does not require any modifications to your existing URL structure.

  • I need unpublication date. – nawfal Oct 28 '15 at 5:36
  • add a filter of node unpublished then get date of it like this prntscr.com/8w63iu – Adeel Nawaz Oct 28 '15 at 5:58
  • That gives me updated time. My nodes could be updated in different ways. I need the date of, simply, unpublication (preferably of last unpublication). For eg, even if my unpublished node got its fields updated today I need the time of when it was actually unpublished. – nawfal Oct 28 '15 at 6:09
  • it is on current time base when time passing it shows the date of it – Adeel Nawaz Oct 28 '15 at 6:29
  • I dont follow u Adi. – nawfal Oct 28 '15 at 7:47

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.