Default Remove Date

7 posts by 3 authors in: Forums > CMS Builder
Last Post: October 30, 2008   (RSS)

By pcolvin - October 26, 2008

Is there any way to have the Special Field Name removeDate have a default setting? What I would like to do is have the remove date default to 6 months from the date the content was created.

Thanks

P Colvin

Re: [pcolvin] Default Remove Date

By Dave - October 27, 2008

Hi pcolvin,

There's no built in way to do that.

If you're comfortable editing PHP code I could give you some instructions on how to change the code to make it do that though.

Let me know if you'd like to give that a try.
Dave Edis - Senior Developer
interactivetools.com

Re: [pcolvin] Default Remove Date

By pcolvin - October 27, 2008

Dave,

I'm willing to give it a try with some direction.

Thanks

Phil

Re: [pcolvin] Default Remove Date

By Dave - October 27, 2008

Hi Phil,

Ok, try this:

- Open /cmsAdmin/lib/menus/default/edit_functins.php
- Make a backup copy of this file first.
- Then search for "function _showDateTime"
- replace this line (in red):

function _showDateTime($fieldSchema, $record) {
global $SETTINGS;

// get date value(s)
$currentTime = date("Y-m-d H:i:s", getAdjustedLocalTime()); # format: YYYY-MM-DD HH:MM:SS (24hour format)


- With this (in red):

function _showDateTime($fieldSchema, $record) {
global $SETTINGS;

// get date value(s)
$defaultTime = getAdjustedLocalTime();
if ($fieldSchema['name'] == 'removeDate') { $defaultTime += 60*60*24*30*6; }
$currentTime = date("Y-m-d H:i:s", $defaultTime); # format: YYYY-MM-DD HH:MM:SS (24hour format)


Give that a try and let me know if it works for you (if it doesn't just revert back to your backup copy you made.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Default Remove Date

By aev - October 28, 2008

Hi Dave,

I just got a request from a client I think can be solved with a small modification to this.

They have a date/time field for creating showing times for a cinema. For this field they would like the time to be 18:00 or 20:00 instead of the current time which rarely are :00 (for the minutes).

How can we make the date field show 'current date 20:00'?

-aev-

Re: [Dave] Default Remove Date

By pcolvin - October 30, 2008

Dave,

That worked! Thanks again.

Phil