OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Plugin problem

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 problem

Postby jkana » Thu Aug 20, 2009 4:13 am

Hello,
I try to make a simple plugin, basically just use hooks. It seem to be working fine, but I still get following error while accesing http://www.kme.zcu.cz/acm/index.php/acm/manager/plugins :
Fatal error: Cannot redeclare class UserEmailEditorovi in /var/www/www/html/acm/plugins/generic/editors/UserEmailEditorovi.inc.php on line 36
.
Plugin basically hide editor's email address for user and replace it by a conference address acm@kme.zcu.cz

Plugin code:
installed in plugins/generic/editors directory
has 2 files:
index.php
Code: Select all
<?php
require('UserEmailEditorovi.inc.php');
return new UserEmailEditorovi();
?>


and
UserEmailEditorovi.inc.php
Code: Select all
<?php
import('classes.plugins.GenericPlugin');
class UserEmailEditorovi extends GenericPlugin {
   function register($category, $path) {
      if (parent::register($category, $path)) {
         HookRegistry::register('AuthorAction::emailEditorDecisionComment',array(&$this, 'callback'));
         return true;
         }
      return false;
      }

   function getName() {
      return 'UserEmailEditorovi';
      }
   
   function getDisplayName() {
      return 'UserEmailEditorovi Plugin';
      }
   
   function getDescription() {
      return 'Nezobrazi jmeno a email editora priposilani komentaru od autora editorovi';
      }
   
   function callback($hookName, $args) {
      $authorSubmission=$args[0];                        
      $email=$args[1];
      $editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
      $editAssignments =& $editAssignmentDao->getEditorAssignmentsByArticleId($authorSubmission->getArticleId());
      while ($editAssignment =& $editAssignments->next()) {
         $email->addRecipient($editAssignment->getEditorEmail(), $editAssignment->getEditorFullName());
         $email->setSubject($email->getSubject().' - '.$editAssignment->getEditorFullName());               
         unset($editAssignment);
         }
      return false;
      }
   }
?>


In classes/submission/author/ AuthorAction.inc.php I change function emailEditorDecisionComment($authorSubmission, $send)
Code: Select all
} else {
         if (!Request::getUserVar('continued')) {
            $email->setSubject($authorSubmission->getArticleTitle());
            if (!empty($editors)) {
               foreach ($editors as $editor) {
                  $email->addRecipient($editor->getEmail(), $editor->getFullName());
                  $email->clearAllRecipients();
                  $email->addRecipient("acm@kme.zcu.cz");                  
               }
            } else {
               $email->addRecipient($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
            }
         }



Any ideas, what I have done wrong?
jkana
 
Posts: 4
Joined: Thu Jun 25, 2009 1:46 am

Re: Plugin problem

Postby asmecher » Thu Aug 20, 2009 8:22 am

Hi jkana,

Try using "require_once" instead of "require" in the plugin's index.php wrapper.

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

Re: Plugin problem

Postby jkana » Tue Aug 25, 2009 2:05 am

Hi Alec,
thank you much. This was the problem, no more errors now.

Regards,
Josef Kana

http://www.kme.zcu.cz/acm
jkana
 
Posts: 4
Joined: Thu Jun 25, 2009 1:46 am

Re: Plugin problem

Postby gonetil » Wed Apr 06, 2011 7:35 am

Hi Josef,
is that plugin you wrote still working? If so... is it possible to get it? We'd really use that functionality in some journals in UNLP Journal's Web Portal www.revistas.unlp.edu.ar
Best wishes,
Gonzalo
gonetil
 
Posts: 9
Joined: Mon Apr 06, 2009 7:24 am
Location: La Plata, Buenos Aires, Argentina


Return to OJS Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron