Plugin conflict with ORCID-plugin

Describe the issue or problem
I developed a plugin for OJS (version 3.3.0.14), which clashes with the ORCID plugin. When my plugin is activated, Register does not show the ORCID button. When deactivated, it does. I stripped down my plugin to localize the problem.

Steps I took leading up to the issue
In my plugin’s register() function, I use

HookRegistry::register('Templates::Common::Footer::PageFooter', array(&$this, 'addSpecialIssueArticles'));

to register function “addSpecialIssueArticles”. This function is as follows:

  function addSpecialIssueArticles($hookName, $params) {
    $templateMgr =& $params[1];
    $output =& $params[2];
    $issue = $templateMgr->get_template_vars('issue');
    /* $descr = $issue->getLocalizedDescription(); */
    /* $vol = $issue->getVolume(); */
    /* $nr = $issue->getNumber(); */
  }

Everything works fine when the last three lines are commented. When I uncomment any one of them, the problem occurs (and my users cannot register using their ORCID).

What application are you using?
I use OJS 3.3.0.14

Additional information
image
image

Hi @gunthermaier,

I’m not 100% sure, but what you’re describing sounds like a problem with hook function return values. See the documentation:

Return a truthy value from the callback function to prevent other callbacks from running.

If your hook callback function returns true, it’ll prevent other registrants to the same hook from being processed. So generally it’s good citizenship to return false from hook functions. (We’ve improved the clarity of this recently, starting with OJS/OMP/OPS 3.4.0 – see the section titled “Hook return conventions” in this discussion.)

TL;DR: It’s almost always best to return false; from a hook registration function, and you might see tricky/strange behaviour if you don’t.

Regards,
Alec Smecher
Public Knowledge Project Team

This topic was automatically closed after 9 days. New replies are no longer allowed.