0

I checked Countdown Timer Field module and some others but it seems they can't help in this issue.

I have a content type (organic group content type) I want this content type have a field for example "open until" and let the users indicate the date, once the countdown ends I want that organic group to be closed.

I want to have an event in rules like for example "countdown ends"

How to do this? thank you

2

You need to use Rules Scheduler. You can create a date field on you content type, and then on some event such as creating or updating the content type you :

  1. check for an old scheduled event on that content instance and delete it
  2. read in the date field.
  3. schedule a new event.

The event that you schedule will be a rules component that you create that will take in the nid of the content type, and then in its action section closes it.

If you need help on this check out Johan Falk from Node One's series on Rules.

  • Ok but how to show the countdown timer inside the node? that is the really tricky part – SsouLlesS Jun 24 '14 at 5:16
  • 1
    Rules Scheduler will run via hook_cron, which means you will not get a very fine grained control of the time that you want things to happen. Elysia Cron can help by allowing you to schedule hook_cron to run more precisely per content type. As for the countdown which you seem to want to be dynamic (not just loaded on page view) you will need to add some custom javascript, and inject that via a preprocess hook or something to that effect on you node type. And if you insist on setting the node to closed at that exact moment that the countdown reaches zero you must add an Ajax callback to do that. – J. Reynolds Jun 24 '14 at 5:38
  • For a quick and dirty solutions I will investigate using jQuery Countdown in combination with Flags. Set the flag to not show via css, and let jQuery Countdown toggle the flag. You can add the Countdown via a preprocess hook, and let it directly act on the flag. (look at the example on the module page). Then let Rules respond to the Flag to set the state of the node. – J. Reynolds Jun 24 '14 at 5:55
  • Im trying with drupal.org/project/field_countdown but I do not know how to permorm an action after the timer ends – SsouLlesS Jun 24 '14 at 5:58
  • 1
    Have a look at index : jquery_countdown. It is a good example of a countdown with a ajax callback. – J. Reynolds Jun 24 '14 at 6:14
1

In Drupal 7 you can use Scheduler module

This module allows nodes to be published and unpublished on specified dates.

Dates can be entered either as plain text or with calendar popups. To use calendar popups you need to install the Date Popup module, which is part of the Date module.

In create a new date field and make this filed as required in your content type. While creating the new content save this filed so that the content will be unpublished on specified dates.

  • Check Using Scheduler for Drupal 7 video for configuration of Scheduler
  • Steps to install the Countdown Timer Field Module

    • Place the entire field_countdown directory into your Drupal sites modules directory (eg sites/all/modules).
    • Enable the module by navigating to: Administration > Modules.
    • This module have dependency on date_popup(Date module) and libraries module, download libraries module and enable both modules.

    • Download jQuery Countdown Timer Library from http://tutorialzine.com/2011/12/countdown-jquery/ .

      • Unzip the downloaded file and rename the directory from countdown to jquery-countdown and copy the folder and paste it inside libraries folder(if libraries folder is not exist then create new).
      • Path to the library should be : sites/all/libraries/jquery-countdown/assets/countdown/jquery.countdown.js. Check this path before proceeding.
    • Go to your content type using admin/structure/types/manage/YOUR_CONTENT_TYPE and click on manage fields of your content type.
    • Add new field and select "Countdown Timer Field" From Field type.
    • Now your timer field is ready to use.
    • Click on Manage Display link to select how do you want to display this field.
    • There are 4 display formats available:-
      • jQuery Countdown Timer without text timer.
      • jQuery Countdown Timer with text timer.
      • Date and time as string.
      • Unix time stamp.
  • yea but the most important task is to show a count down timer how to do that with that module? Im trying to use this module drupal.org/project/field_countdown I already isntalled that module but I do not know how to trigger an event when the countdown ends alpha.grupo.ly/node/2 – SsouLlesS Jun 24 '14 at 5:40
  • I have updated my answer :). You know need to trigger any event, Scheduler module will take care of it. It will unpublish the content once the end date is reached.. – inizio Jun 24 '14 at 6:14

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.