Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
How to change the default setting of timestamp
I’m using TXP to help a few users who aren’t very “computer savvy”. I am trying to make things as simple as possible, so I want the default for the check box for the “Set timestamp to now” to be UNCHECKED. How do I go about doing this?
“It is better to keep your mouth closed and let people think you are a fool than to open it and remove all doubt.”
- Mark Twain
Offline
#2 2006-10-06 00:54:30
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: How to change the default setting of timestamp
Make an admin-side plugin, and toggle the checkbox via JavaScript.
Offline
Re: How to change the default setting of timestamp
I really wish I knew how, but I’m only good at the css side of things. Is anyone willing to whip up a little plugin to do this for me? (wink, wink, nudge, nudge…) Pretty please? :-)
“It is better to keep your mouth closed and let people think you are a fool than to open it and remove all doubt.”
- Mark Twain
Offline
#4 2006-10-06 05:11:30
- anoke
- Archived Plugin Author
- Registered: 2006-04-15
- Posts: 152
Re: How to change the default setting of timestamp
in txp_article.php around line 650 in timestamp section, you find
<code>n.graf(checkbox(‘publish_now’, ‘1’, ($Status < 4), ‘’, ‘publish_now’).’<label for=“publish_now”>’.gTxt(‘set_to_now’).’</label>’).</code>
and around 688
<code>
n.graf(checkbox(‘reset_time’, ‘1’, ($Status < 4), ‘’, ‘reset_time’).’<label for=“reset_time”>’.gTxt(‘reset_time’).’</label>’).
</code>
chance both <code>($Status < 4)</code> to <code>’‘</code>
That should change the timestamping. Works here and I didn’t notice it breaking anything. But if it does then “bohoo” – that’s the price of hacking.
Admin-side plugin sure is the more elegant way.
- When chickens are cold, they roost in trees; when ducks are cold, they plunge into water -
Offline
Re: How to change the default setting of timestamp
Thanks for the hack. If no one is willing to write a plugin for me, I may try it.
Anyone up for helping a coding loser? I’m really cool otherwise… :-)
“It is better to keep your mouth closed and let people think you are a fool than to open it and remove all doubt.”
- Mark Twain
Offline
#6 2008-07-03 11:07:11
- mrpvienna
- New Member
- Registered: 2008-07-03
- Posts: 2
Re: How to change the default setting of timestamp
I am bumping this thread up because I had to make this in 4.0.4/6 and 4.0.7
first of all the hack works in 4.0.4 and 4.0.6.
In 4.0.7 the code is similar but there is a variable instead of the Status query:
All code extracts are from lib/txp_article.php
line 658
n.graf(checkbox('publish_now', '1', $publish_now, '', 'publish_now').'<label for="publish_now">'.gTxt('set_to_now').'</label>').
change this line to
n.graf(checkbox('publish_now', '0', $publish_now, '', 'publish_now').'<label for="publish_now">'.gTxt('set_to_now').'</label>').
This will set the “checked” status of the checkbox to unchecked, even with new articles (which I need because the website is more static than dynamic). The initial problem was that after MLP was installed and the articles had to be reassigned i f**** up all the timestamps. So I disabled it :p
You could also tweak this:
line 74
@
if ($publish_now==1) {
$when = ‘now()’;
} else {
$when = strtotime($year.‘‘.$month.’’.$day.’ ‘.$hour.’:’.$minute.’:’.$second)-tz_offset();
$when = “from_unixtime($when)”;
}
@
to anything you like.
at line 283:
$reset_time = $publish_now = ($Status < 4);
here you can tweak the statii more detailed.
hope this helps (it did, for me! :))
This option (disable “reset timestamp” if editing existing article) should really be covered in the next release – I dont think anyone wants to reset the timestamp when correcting typos!
Last edited by mrpvienna (2008-07-03 12:22:18)
Offline
#7 2008-07-03 11:47:45
- net-carver
- Archived Plugin Author
- Registered: 2006-03-08
- Posts: 1,648
Re: How to change the default setting of timestamp
mrpvienna wrote:
…The initial problem was that after MLP was installed and the articles had to be reassigned i f**** up all the timestamps. So I disabled it :p
Hello mrpvienna.
My reply is slightly OT but as author of the MLP pack I want to follow this up. Is the “i” in your quote above meant to be “it”?
If so, and you feel there is something that needs addressing with the pack itself, could you post a bug report on the MLP pack thread and I’ll see what I can do to sort it out — I want the pack to be a helpful resource. Many thanks in advance. :)
— Steve
Offline
#8 2008-07-03 12:25:23
- mrpvienna
- New Member
- Registered: 2008-07-03
- Posts: 2
Re: How to change the default setting of timestamp
I or it : This can be chosen freely – I could have thought about it when I did it, and so MLP could have done too :)
But this is more of an textpattern-wide issue not just MLP. MLP did all right, thats why I use it :)
edit:
Anyway, to get back on topic: My 4.0.7 hack does not seem to work correctly with existing articles which are hidden.
at line 283 you see that my “hack” only works for status >= 4 which means Live / Fixed. lower this to 1, 2 or 3 to make this happen for other statii
Last edited by mrpvienna (2008-07-03 12:34:03)
Offline