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
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.

Plugin Development - Hooks

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


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.

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.

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

Return to OJS Development

Who is online

Users browsing this forum: No registered users and 2 guests