Drupal 7 Publication Date Module
Share with Others
In this video we look at the Publication Date module. This module allows content creators to use the date in which the content on their website is published and NOT just when it is created. In other words, if you create a post a week prior to publishing it, this module will use the date in which the post goes to published. Again, this is a simple module but can be extremely helpful if you post a lot of content or have a habit of writing content days or weeks prior to publishing.
Hello everybody and welcome to Episode 176 of the Daily Dose of Drupal. I am Adam and today we are going to be looking at a module that kind of came to me through some of the channels I’m subscribed through Drupal and that is the Publication Date Module.
This isn’t actually a very simple module and actually it comes in handy really well with Code Karate so I definitely wanted to take the time and show everybody this module and just give an idea of that it can do. So before we jump into that and do that demo I wanted to again just direct you over to codekarate.com.
A lo t of things have been changing here in the last couple of weeks we got a new logo which you can check out and we have a post about that so read about that and kind of how our brand has transformed over the last 12 months and even further back from that.
Also we just release our first cheat sheets which is in Drush and then coming soon hopefully within the next week of this post, one on a Get as well. So make sure to sign up for those and you’ll receive those absolutely free. Alright so let’s get down to this module. Again we’re looking at the Publications Date Module and we’re going to using of course the Drupal 7 version of this module. There is a Drupal 6 version available but I’m going to be using 2.0 Drupal 7 version. So what this module does is it allows you to have content posted or published based on the Publication Date.
Typically when you post content with Drupal and uses the created date or revision date, well that isn’t necessarily that date you are publishing it to the public. For example at Code Karate we will write blog posts that haven’t set unpublished for maybe a week at the time. So once we go to publish them we want to use the new published date or the current date and not the date in which we created it so people can easily sort it by the newest content on the site. And that’s what this module is going to do. It’s going to allow you to use the actual date when the content goes live.
So what you do, again really simple, we’re just going to turn this module on, let’s go to modules, location date and you can see I already have it on. There is nothing to configure with this module but once you turn it on it does add a field to your content types so if I jump over to a content type I have here and I scroll down and look under my Publish option setting.
This Publish On field is the field that adds to your content type. If you look at the modules page it talks a little bit about that and you can also use in a template file by adding this field Node Publish Add. So if you wanted to use it in a template file you could do that as well but we’re not going to need that for this video so we’re going to hop back here again so it’s Unpublished on and then you can see there’s a Publish field as well.
So I’m going to show how to just add and how it works. So if I want to add a new piece of content, so say I want to post a blog article or something to my site and I’m going to want keep it live in a week or I’m writing it today. So I’m just going to come in here and select his one and I’m going to put…so I’m going to put that and place some text in. So in theory this is a short little post that I’m going to do.
So I’m going to come here and say I don’t want to publish it that’s why I’m publishing everything right now. So this is just something in the Q, I’m going to save it and you’ll load here, I’m going to see this field printing right here. This is actually the created date timestamp. So I’m recording this at 10/30/2014 at 6:50 in the morning. So you can see that this is not the published date. But technically it is at the moment but there’s nothing published, it’s unpublished. So we’re just going to let this been here in one minute and then I’m going to publish it and you’ll see the change. So if we hop back to this, I’m actually using this, it integrates really well with views.
So on this view you can see I’ve added the Publish Ad field so this will show the newest published date once I publish the content so you can integrate with views which is kind of handy. So now that my time is switched to 6:50 to 6:51i could show you the difference. So if I go back into my content up here, let’s note one thing here. Note that nothing is appearing in my field.
This is where the content will appear but if I go to my content and I see I publishing date test which I just created and then I go ahead and select my publish options and select Publish. Now I’m going to leave this Publish on field blank. But according to what it said here is if you leave blank it’s going to use the time of submission, the time it goes published. So if I click publish and then I go look at the view where it’s going to be displayed, I’ll see right here it says 6:51 and it’s kind of the value that show in that but right there it’s the thing I just created so it says there October 30, 2014 at 6:51 which remember if I went to create it it was 6:50.
I didn’t actually have to input the publish date to get it. Now once you’re already saying, well there’s always around this and you can and it’s true. There’s a way to do this, one each is if you go into content, instead of…say we don’t have the Publishing module on, you could just cut me into other information and go ahead and delete that Altered On Time and then save it and then it’ll automatically use the current time of the submission which is leave blank to use the time. But that’s just another step to do, it’s kind of up to you whether you want to use it or not, if you post another content like we are, it comes in handy to use something like this but maybe of course it is your choice, it is a simple module at the end of the day but that’s what it does.
Again it integrates very well with views, you can use it in template file as well. So there’s a couple of different uses for it, you can customize of course the different display options for the timestamp. It doesn’t have to display in this format, by any means you can customize that using a custom date field. So that is the Publication Date Module.
Okay I think that’s it for today. Again make sure to head over to Code Karate and check on everything on what’s going on, love your feedback and a new logo and your thoughts are always helpful and again make sure you get that cheat sheets, they are free and available for you. Alright guys until next time. Thanks.