Recent Topics

1 Nov 20, 2006 16:20    

I think I'm finally getting a grip on plugins, which is a kind way of saying I don't know what I'm doing. I know what I *want* to do though.

So I'm trying to make a plugin. A contest plugin that bloggers will be able to post entries into. So far it's a toolbar that lets them select and enter stuff, a renderer that puts a comment into the post (in the form of <!-- foo -->), a tab that lets me add options as need be, and a database to store the info upon entry. That's where I'm stuck. I can't see how to make a plugin add info to the database upon posting. RenderItemAsHtml isn't the right place for it because that would mean each view would add the same content again and again, though I think a brute force answer could be found. (If the db doesn't have this exact info then add it.)

For what I'm doing I can live without giving edit permission, but ideally the plugin would allow editing the info in the post - and maybe even deleting it. So to me that rules out RenderItemAsHtml because it has to pay attention to if we're posting or editing.

Does anyone know of a plugin that does something like this? If so I'll add it to the list of plugins I take apart to make this one happen.

2 Nov 20, 2006 23:59

Searching the manual led me to http://doc.b2evolution.net/HEAD/plugins/Plugin.html which led me to http://doc.b2evolution.net/HEAD/plugins/Plugin.html#AfterItemDelete - hooray! At this point it looks like I can use AfterItemDelete and AfterItemInsert and AfterItemUpdate to do stuff with my plugin's database after the blogger does his/her thing. Does anyone know of a plugin that uses these methods? To me a working example is worth way more than an expectation of knowledge on my part...


Form is loading...