Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#25 2005-05-24 23:58:26
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: [archived] ob1_modified
“..if I sounded too uptight..”
Nope, you didn’t. :) My brain just went like: “Well… that shut me up.” ;P
Offline
Re: [archived] ob1_modified
I haven’t found the bug yet with author and now I got a week of from work and I am moving. Investigation will continue later on.
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
doogiez,
I’ve found the problem. My documentation said one thing and the plugin wanted another. Now with version 0.51 you do as intended with author, namely format="author"
and voila it works. What I had forgotten was that earlier it was used with author="1"
and I’ve hadn’t changed the code (since I personally don’t need to use the author attribute).
Hope this clears your (and maybe others) problem.
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
#28 2005-06-02 14:22:33
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: [archived] ob1_modified
Thanks, obeewan!
Offline
#29 2005-10-11 04:06:52
- datumax
- Member
- Registered: 2005-01-12
- Posts: 16
Re: [archived] ob1_modified
This plugin fits me perfect! But . . .
I can’t get my the time to show up, only the date. Here’s my tag:
txp:ob1_modified format=“M.d:y @ h:i” starttext=“Last modified “ /.
Last edited by datumax (2005-10-11 04:07:15)
Offline
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