Looking for guidance on modifying an update from a plugin

OCS development discussion, enhancement requests, third-party patches and plug-ins.

Moderators: jmacgreg, michael

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.
Posts: 5
Joined: Fri Apr 03, 2009 7:56 am

Looking for guidance on modifying an update from a plugin

Postby claywhipkey » Fri Apr 10, 2009 3:26 pm

I'm working on a plugin that will theoretically add the ability to attach a few more settings to both a conference and a paper. Specifically, I am creating a plugin that will include Twitter chats based on hashtag, Flickr photostream based on tag, and links to blog articles based on a Google blog search RSS feed. What I want to do is allow a scheduled conference to have its own set, and also allow each presentation (paper) to have unique streams as well. I'll use the paper as an example:

I have already got the plugin responding on the screen in the appropriate place for both the conference home and the paper view page (had to drop custom hooks into those templates). I will be off to the races once I am able to retrieve the twitter/flickr/blog settings from within either the conference home template or paper template. My targeted solution is to have those values saved as additional conference_settings or paper_settings.

I have been able to insert some additional form fields into the "edit metadata" screen of a submission (paper). I *think* what I need to do is somehow trigger my plugin to intercept the execute() method in MetadataForm.inc.php, and somehow add my extra settings to the paper object before it gets saved. That appears to be where the update of the paper's settings begins. My problem is that I'm not sure if there are any hooks available in the process which would make that simple. My goal is to make the plugin as self-contained as possible, without having to patch the core files (custom template hooks notwithstanding).

Obviously, after getting the paper settings worked out, I would need to do something similar for the conference itself. I'm thinking probably adding the settings onto the Scheduled Conference Setup > Details screen. Input on that would be good, too.

I have to get this functionality working by our conference (in two weeks), so I will continue to work on this, but any insight from those with more OCS knowledge would be mighty helpful.


Posts: 5
Joined: Fri Apr 03, 2009 7:56 am

Re: Looking for guidance on modifying an update from a plugin

Postby claywhipkey » Mon Apr 13, 2009 10:24 am


I have now successfully figured out how to save my custom settings to the paper_settings table. Unfortunately, I can't make the plugin completely without mods to core files. It requires adding some custom hooks to templates, but also in a class file. I also had to modify the getLocaleFieldNames() method in the PaperDAO.inc.php file because it contains a hard-coded array of the paper_settings to include in updates.

I'll update again once I finish adding the scheduled conference settings.

Posts: 952
Joined: Mon May 05, 2008 10:29 am
Location: Vancouver, BC

Re: Looking for guidance on modifying an update from a plugin

Postby mcrider » Tue Apr 14, 2009 5:50 pm

Hi Clay,

Interesting plugin idea, and we'd be appreciative to see your final product! One suggestion I can think of to make your plugin more self-reliant is to associate the hashtags and other data outside of the paper's metadata page, and within the plugin's own interface, and store the data in a table specific to the plugin (see the static pages plugin for an example of how to get a table unique to the plugin into the database), or even just in the paper_settings table. In the plugin's settings page, you could list each paper and allow the option to enter tags respective to that paper, which when saved will store the paper ID and tags in the plugin's table. This table can then be accessed (probably by another plugin) in the reading tools for each paper by looking up the paper ID and pretty printing the rest of the row.

I appreciate the complexity of that solution, but I'm not certain of an easier way without modifying templates and code. FYI, this type of enhancement has been marked as a feature suggestion for the next major version of our software.

Let us know if you have any further questions and what your final solution is.


Return to “OCS Development”

Who is online

Users browsing this forum: No registered users and 1 guest