You are viewing the PKP Support Forum | PKP Home Wiki

Using LoadHandler hook

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.

Using LoadHandler hook

Postby pvadrevu » Sat Apr 23, 2011 4:44 pm

Hi all,
I am trying to write a small plugin that would enable the reviewers to undo their decision to reject a previous article review offer. To do this I would like to add a new "undo decision" links on the archived submissions that a reviewer gets to see. As I found no particular hooks that I can use for this, I wanted to use the loadhandler hook to intercept all calls to journal/reviewer/index

Code: Select all
HookRegistry::register ('LoadHandler', array(&$this, 'handleRequest'));   

Code: Select all
function handleRequest($hookName, $args) {
      $page =& $args[0];
      $op =& $args[1];
      $sourceFile =& $args[2];

      if ($page === 'reviewer' && $op === 'index') {
         define('HANDLER_CLASS', 'ExampleHandler');   
         $sourceFile = $this->getPluginPath() . '/' . 'ExampleHandler.inc.php';      

The ExampleHandler class for now is just an empty subclass of ReviewerHandler:

Code: Select all
class ExampleHandler extends ReviewerHandler {
   function ExampleHandler() {

The callback function is being invoked but all I get is this error:

Fatal error: require_once() [function.require]: Failed opening required 'classes/reviewer/ReviewerHandler.inc.php' (include_path='.:/data/www/press/ojs/htdocs/classes:/data/www/press/ojs/htdocs/pages:/data/www/press/ojs/htdocs/lib/pkp:/data/www/press/ojs/htdocs/lib/pkp/classes:/data/www/press/ojs/htdocs/lib/pkp/pages:/data/www/press/ojs/htdocs/lib/pkp/lib/adodb:/data/www/press/ojs/htdocs/lib/pkp/lib/phputf8:/data/www/press/ojs/htdocs/lib/pkp/lib/pqp/classes:/data/www/press/ojs/htdocs/lib/pkp/lib/smarty:.:/usr/share/php:/usr/share/pear') in /data/www/press/ojs/htdocs/lib/pkp/includes/functions.inc.php on line 30

Where am I going wrong? Can someone please help me with this.

Posts: 4
Joined: Tue Feb 08, 2011 2:12 am

Re: Using LoadHandler hook

Postby pvadrevu » Sat Apr 23, 2011 5:02 pm

Sorry, I just made a silly mistake in my import path. Should have been pages.reviewer...

This is my first time developing a plugin. So, can someone confirm if my approach is correct or if I should be using a different hook.

Thank you,
Posts: 4
Joined: Tue Feb 08, 2011 2:12 am

Re: Using LoadHandler hook

Postby mcrider » Mon May 02, 2011 10:42 am

Hi Phani,

That looks alright -- though I think you can just call (from your handleRequest() method) $this->import('ExampleHandler'); before you define the HANDLER_CLASS. Take a look at e.g. plugins/generic/counter/ for an example.

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

Return to OJS Development

Who is online

Users browsing this forum: No registered users and 2 guests