By stongo on
I'm trying to find an alternative to the "Node: has new content" filter and fields provided in Views 2.0
Does anyone know if there's any modules that tag new or updated content from a timestamp based value? For example, being able to set content to be tagged as "updated" or "new" in views based on the node being updated/created in X amount of days from NOW.
I need anonymous users to be able to see the new or updated tags, thereby making the current views method unusable.
Comments
subscribing
subscribing
subscribing
subscribing
I got this working with
I got this working with views. You'll need the views_customfield module installed.
In you view field, select "Node: Post date" and check "Exclude from display."
Then add a customfield.
In the "Value" section copy/paste the code below. Note the number 4 represents 4 weeks, so change it accordingly.
I have created a module which
I have created a module which extends the "Node: Has new content" widget in views. With it markers will persist for New or Updated content for a set period of time for anonymous users. The period of time is set through the UI. For logged in users the "Node: Has new content" field will function as normal. Can see project page here (http://drupal.org/project/views_ephemeral_field).
Stinky, your solution worked
Stinky, your solution worked perfectly, thank you so much!
Begun, your solution wasn't a bad approach either, but I don't think the "Node: Has new content" widget does quite what I'm looking for.
All I needed was to inject the following on any content in my view that was new in the past 2 weeks; no interest in showing this on stuff that hadn't been clicked on yet.
Thanks all for your efforts!
-ben
Great Solutions Everyone
Two great solutions to this issue. Thanks so much, I think lots of people could find this useful.
Drupal 7
Thanks stinky for an idea which has let me write my own code for Drupal 7. I would like to point out that for working solution I have to install views php and change code to not to use date_difference which seems to be unavailable in Drupal 7 Date API (or maybe I made some mistakes which makes date_difference unavailable).
Here is my solution:
I placed this code inside Global:PHP field in 'Output code' section. It simply prints 'new' for every node that isn't older than 7 days ago.
$diffis the difference in seconds between now and node creation.