0

I would like to put a countdown for each node using a field expiration date (whose values users have already entered).

I explain you my case:

My user publishes an event that have an expiration date (I already have many values for this field inserted by the users and some of them are of events still in progress). I would like to insert a countdown in each page of the events, based on the expiration date inserted by the user and the date when the user has published the event on my website.

I tried with this module: field timer but I don't know how to do the connection between this module and the expiration date.

Thanks in advance for your help.

  • Could you explain why you need two fields for the same date, really? If they are to be made identical, and nothing ever changes them, why two?! – Mołot Sep 15 '15 at 21:28
  • You're right, I didn't explain. I've already saved many nodes with the normal expiration date but I'd want to add a countdown related to that date field...if there's a best way to do that please let me know...many thanks – Luke Sep 15 '15 at 21:43
1

I assume you have two fields in one content type - countdown_date and expiration_date. Both values user has to insert manually. And after submit action, you want to assign expiration date to both fields, yes?

Read about hook_node_submit(). In your MYMODULE_node_submit($node, $form, &$form_state) you can check the type of content, then assign expiration_date to countdown_date. This method works with save and preview's action.

For more detailed answer I need more details about these fields.

  • Thanks. My users must create only expiration_date of the subscriptions of their event. The countdown_date is set between the "submit day" (the date when the user publishes the node) and the expiration_date. Maybe there's a best way to make a countdown from a pre-existent date field...sorry, I don't have much experience with drupal.. – Luke Sep 15 '15 at 21:54

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.