You are viewing the PKP Support Forum | PKP Home Wiki

'SchemaPlugin::indexRecord' hook in a plugin

Open Harvester Systems support questions and answers, bug reports, and development issues.

Moderators: jmacgreg, michael, John

Forum rules
Developer Resources:

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.

'SchemaPlugin::indexRecord' hook in a plugin

Postby mparienti » Wed Apr 07, 2010 8:49 am


I would like to create a plugin which will put in dedicated tables the different values of some field (title, authors, etc). I need to have all the values of these fields to create a special form.

I thought that a plugin could insert the values into the tables with the SchemaPlugin::indexRecord hook. I began to write that plugin. I managed to create the plugin: it appears in the site administration, and I enabled it.

But it doesn’t do anything. I insert new records, but nothing happens: no file is created, no error message, nothing.

Here is essential extract of the code I wrote:

Code: Select all
class eePlugin extends GenericPlugin {

  function register($category, $path) {
    $result = parent::register($category, $path);
    if ($result) {
      HookRegistry::register('SchemaPlugin::indexRecord', array(&$this, 'saveValues'));
    return $result;

   * Save field values in dedicated tables
  function saveValues($hookName, $args)
    $archive =& $args[0];
    $record =& $args[1];
    $field =& $args[2];
    $value =& $args[3];
    $attributes =& $args[4];

    $fp = fopen('/tmp/data.txt', 'w+');
    fwrite($fp, "$archive \n");
    fwrite($fp, "$record \n");
    fwrite($fp, "$field \n");
    fwrite($fp, "$value \n");
    fwrite($fp, "$attributes \n");

    return false;


  /* cut */

Any help is welcome,
Posts: 1
Joined: Wed Apr 07, 2010 7:13 am

Re: 'SchemaPlugin::indexRecord' hook in a plugin

Postby asmecher » Tue Apr 20, 2010 11:27 am

Hi mparienti,

I've filed this as a bug at http://pkp.sfu.ca/bugzilla/show_bug.cgi?id=5331; you can CC yourself there to receive updates when the bug status changes. Meanwhile, you should be able to use another hook for this purpose, i.e. recorddao::_updaterecord and recorddao::insertrecord, which should be called when a record row is inserted and updated in the "records" table.

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

Return to Open Harvester Systems Support and Development

Who is online

Users browsing this forum: No registered users and 1 guest