[geeklog-devel] Plugin API: Extend Admin's story editor

Blaine Lang geeklog at langfamily.ca
Sat Feb 26 12:31:02 EST 2005


Hi Dirk,

Is this the API change that you were referring to in a forum post on 
geeklog.net?
http://www.geeklog.net/forum/viewtopic.php?forum=6&showtopic=48722

We added a simailar API at 1.3.10 for comments PLG_commentPreSave() but did 
not consider stories at the time.
I wonder if we could not make a generic API for content and then it may be 
possible to have it used for any content (stories, comments, or other 
plugins).

You were noting the API would be called after the save or the story record 
created correct?

Can you give some examples of use ( I know bbcode is definitely one) and why 
it's better to do the call after the record is created and not a  PreSave 
like we have now for the comments.

Blaine
----- Original Message ----- 
From: "Dirk Haun" <dirk at haun-online.de>
To: <geeklog-devel at lists.geeklog.net>
Sent: Saturday, February 26, 2005 8:26 AM
Subject: [geeklog-devel] Plugin API: Extend Admin's story editor


For two clients now, I needed a way to extend the Admin's story editor.
I've added two plugin API functions for this: One that is called before
the story editor is displayed (so that the plugin can provide its items
to be displayed in the editor) and one when the story is saved.

I'll talk about the former at another time. The latter is the more
interesting one anyway.

The way I've currently implemented it is that BEFORE the call to DB_save
that actually saves the story, the new plugin API function is called,
giving the plugins a chance to manipulate the data that goes into the
story and save their own data.

However, I've been thinking if it wouldn't make more sense to do the API
call AFTER the story has been saved. Plugins could still manipulate the
story's data if they needed to (read it and write it back) and it would
also ensure that the story has actually been saved.

Notifying plugins that a story has been saved/changed would also go
nicely with the idea of the forum replacing the comments section, <http:/
/project.geeklog.net/tracker/index.php?
func=detail&aid=249&group_id=6&atid=108>, as well as with this patch,
<http://project.geeklog.net/tracker/index.php?
func=detail&aid=382&group_id=6&atid=107>, to pre-populate some comments.

So the call would be something like

    plugin_storysaved_pluginname($story_id)

and the plugin could return an error message in case something went wrong
(in which case admin/story.php would call up the story editor again and
display that error message).

The only problem (but one that also exists when calling the API function
before the DB_save) would be if plugin #1 already did something based on
the new/changed story and then plugin #2 reports an error. Plugins using
that API function would have to be prepared for that case then.

Thoughts?

bye, Dirk


-- 
http://www.haun-online.de/
http://www.tinyweb.de/

_______________________________________________
geeklog-devel mailing list
geeklog-devel at lists.geeklog.net
http://lists.geeklog.net/listinfo/geeklog-devel 




More information about the geeklog-devel mailing list