OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Plugin Development - Hooks

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

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
Developer Resources:

Documentation: The OJS Technical Reference and the OJS API Reference are both available from the OJS Documentation page.

Git: You can access our public Git Repository here. Comprehensive Git usage instructions are available on the wiki.

Bugzilla: You can access our Bugzilla report tracker here.

Search: You can use our Google Custom Search to search across our main website, the support forum, and Bugzilla.

Questions and discussion are welcome, but if you have a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a technical support question, try the OJS Technical Support subforum.

Plugin Development - Hooks

Postby thiessenp » Fri Jan 11, 2008 1:51 pm

Hi,

I'm working on a basic plugin for OJS 2.2. I'm at the registering a hook part of the code, and would like to add a link to the Author's Active Submissions Page, under, "Start a New Submission". I have two questions:

1. I couldn't find anything in the Hook List in the OJS Tech. Document that seamed related to adding a hook to the Author's Active Submissions Page - is their a related hook like: Templates::Author::ActiveSubmission?

2. How flexible is OJS in adding hooks?

Then again my understanding of hooks in OJS could be off.

Thanks,
-peter
thiessenp
 
Posts: 26
Joined: Wed Nov 28, 2007 1:08 pm
Location: Toronto

Re: Plugin Development - Hooks

Postby asmecher » Fri Jan 11, 2008 3:07 pm

Hi Peter,

Modifying existing templates is one of the cases where simply modifying the template is easier than using a plugin -- but it is possible to do with a plugin, and since it doesn't involve modifying existing code, upgrades etc. can be easier.

To do this, you'll need to check Request::getRequestedPage() and Request::getRequestedOp() to make sure you're dealing with a page that you want to modify. If so, use Smarty's postfilter mechanism to register an output filter that watches for the "Start a New Submission" link and, if it's found, appends another link.

If you'd like an example that uses postfilters, have a look at the rounded corners plugin (plugins/generic/roundedCorners). This plugin is a little more complicated than what you'll be doing.

Another option you have is to drop some hooks of your own into OJS templates and write a template that uses them. This does involve modifying the template code, but this is a good way of keeping a logical separation between OJS and your own modifications.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8597
Joined: Wed Aug 10, 2005 12:56 pm


Return to OJS Development

Who is online

Users browsing this forum: No registered users and 1 guest