Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: [archived] ob1_modified
Hi, obeewan…
I just installed ob1_modified (rel. 0.51) and I think I spotted a tiny glitch…
I’m using it in my default form like:
<pre>
Published: <txp:posted /> by <txp:author />
<txp:ob1_modified output=“differs” starttext=”/ Last modified: “ />
<txp:ob1_modified output=“differs” format=“author” starttext=” by “ />
</pre>
Which, supposedly outputs something like:
Published: May 25, 2006 by Mariano Absatz / Last modified: May 31, 2006 by Mariano Absatz
when used on a recently modified article and something like:
Published: May 25, 2006 by Mariano Absatz
when used on an article that was created and never modified.
However, the actual outcome of the latter is something like:
Published: May 25, 2006 by Mariano Absatz by
Note the last by (actually surrounded by spaces).
After experimenting a bit and adding some debugging info to the $date_out variable, I noticed that, when you have $format=="author", $lastMod doesn’t get initialized and hence, $lastMod==$thisarticle["posted"] is false, so you don’t return "" early, the last lines get executed and you eventually return $date_out with $date_out==" by "
This can be solved if you initialize $lastmod before checking for $format=="author".
The following patch should solve this:
<pre>
—- ob1-modified-0.51.php 2006-05-31 16:17:12.895914863 -0300
+++ ob1-modified-0.51-baby.php 2006-05-31 16:16:29.558671887 -0300
-5,14 +5,14
if (is_array($atts)) extract($atts);
$output = (empty($output)) ? ‘always’ : $output;
+ $lastMod = fetch(‘LastMod’,‘textpattern’,‘ID’,$thisarticle[‘thisid’]);
+ $lastMod = strtotime($lastMod);
if($format==“author”){
if(empty($thisarticle[“author”])){
$lastModAuthor = fetch(‘LastModID’,‘textpattern’,‘ID’,$thisarticle[‘thisid’]);
$date_out = fetch(‘RealName’,‘txp_users’,‘name’,$lastModAuthor);
}else $date_out = $thisarticle[“author”];
}else{
- $lastMod = fetch(‘LastMod’,‘textpattern’,‘ID’,$thisarticle[‘thisid’]);
- $lastMod = strtotime($lastMod);
$date_offset = $lastMod;
at least, it worked for me.
HTH
UPDATE: In case you are not inclined to patch & compile, I generated this file for download: ob1-modified-0.51-baby.txt. You can download it, copy and paste it in your admin => plugin window.
It is the 0.51 version with this patch applied and the help text with a line pointing to this very thread in the changelog… As I didn’t find a license in obeewan’s site, I’m assuming it is either GPL or BSD and by publishing this here I hope I’m not violating either one. If this is not the case, please tell me so.
Last edited by baby (2006-07-14 19:45:30)
Mariano Absatz – El Baby
I don’t suffer from insanity. I enjoy every minute of it.
Offline
Re: [archived] ob1_modified
Updated to work for TXP 4.x with no errors being produced.
And as always, bug reports are welcome.
See the first post of this thread for links.
Update
I will soon release a new version that uses joins on the database SELECT so instead of two queries beeing produced there will only be one (when writing this I got Highlander flashbacks :).
Last edited by obeewan (2007-09-13 05:42:31)
Plugins: ob1_advanced_search 1.032b, ob1_search_score 1.0, ob1_pagination 2.5, ob1_title 4.1, ob1_modified 2.1
“Let your plans be dark and as impenetratable as night, and when you move, fall like a thunderbolt.”
— Sun Tzu
Offline
Re: [archived] ob1_modified
Is it just me or has 4.0.5 totally changed the way articles are dated? I mean, when clicking Write I now get a default date in the bottom right fields, the checkbox is not checked and thus every article I publish is “modified” already when going live for the first time.. (this explains what I thought was a bug with this plugin.)
Is there a way to get around this?
Offline
Re: [archived] ob1_modified
Are you talking about how saving as a draft means it resets the posted date every time?
I’m not a big fan of that either..
‘Not familiar with a fix for that…
textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation
Offline
Re: [archived] ob1_modified
You could hack the adminpart and make the “reset time to now” checkbox always selected. It doesn’t change the fact that the modified time will be now if you write older articles though.
If I think back, earlier in TXP it saved the modifed field as blank.
Plugins: ob1_advanced_search 1.032b, ob1_search_score 1.0, ob1_pagination 2.5, ob1_title 4.1, ob1_modified 2.1
“Let your plans be dark and as impenetratable as night, and when you move, fall like a thunderbolt.”
— Sun Tzu
Offline
Re: [archived] ob1_modified
If you have hak_tinymce (or any other plugin with support for a javascript callback when creating new articles) this little snippet fixes this issue:
if($(‘input.publish[@name=“publish”]’)) $(‘#publish_now’).attr(‘checked’, true);
At least this is what fixed it for me.
cheers,
/Anton
Offline
Re: [archived] ob1_modified
Updated to v2.1, see first post for links.
v2.1 [2007-10-06]
Code
- Re-wrote SQL to now get all the data in just one query (with joins)
Plugins: ob1_advanced_search 1.032b, ob1_search_score 1.0, ob1_pagination 2.5, ob1_title 4.1, ob1_modified 2.1
“Let your plans be dark and as impenetratable as night, and when you move, fall like a thunderbolt.”
— Sun Tzu
Offline
Re: [archived] ob1_modified
Henrik, in the 4.0.x branch (what is to become 4.0.6) $thisarticle[‘modified’] exists. Might save a query in your plugin.
Offline
Re: [archived] ob1_modified
Yeah. Anton gave me the heads up on that. But since I couldn’t wait until 4.0.6 was released I sent this one out pre-release.
When 4.0.6 is out that will remove one join in a future release of the plug in.
Plugins: ob1_advanced_search 1.032b, ob1_search_score 1.0, ob1_pagination 2.5, ob1_title 4.1, ob1_modified 2.1
“Let your plans be dark and as impenetratable as night, and when you move, fall like a thunderbolt.”
— Sun Tzu
Offline
#40 2008-03-27 20:10:43
- Ruhh
- Member

- From: dakota dunes
- Registered: 2008-01-20
- Posts: 305
Re: [archived] ob1_modified
Is there a way to use this plugin outside of article context?
Using the tag in a page gives me an error.
Last edited by Ruhh (2008-03-27 20:11:09)
<txp:Ruhh />
Offline
Re: [archived] ob1_modified
Ruhh wrote:
Is there a way to use this plugin outside of article context?
What would be the semantics of it?… if this says that the article was last modified xxx days ago, it doesn’t seem to make sense outside of an article…
Using the tag in a page gives me an error.
It seems a sensible thing to do.
Mariano Absatz – El Baby
I don’t suffer from insanity. I enjoy every minute of it.
Offline
#42 2008-04-02 03:13:49
- Ruhh
- Member

- From: dakota dunes
- Registered: 2008-01-20
- Posts: 305
Re: [archived] ob1_modified
well, i was trying to use this plugin as in site “last modified” so it would not be used for articles.
i can not find a working download link for a plugin that would show the date on a site being last modified.
<txp:Ruhh />
Offline
Re: [archived] ob1_modified
Ruhh wrote:
well, i was trying to use this plugin as in site “last modified” so it would not be used for articles.
i can not find a working download link for a plugin that would show the date on a site being last modified.
textpattern.org uses that (under the navigation of most every page except the frontpage)..
It’s called like this:
<txp:article_custom limit="1" form="moddate" allowoverride="0" />
moddate form contents:
Content last modified
<txp:ob1_modified format="l j F Y" output="always" />
textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation
Offline
#44 2008-04-02 20:03:10
- Ruhh
- Member

- From: dakota dunes
- Registered: 2008-01-20
- Posts: 305
Re: [archived] ob1_modified
Ok I got it working. Thanks!
<txp:Ruhh />
Offline