...
,sendNewsletter: function(btn,e) {
MODx.msg.confirm({
title: _('goodnews.newsletter_send')
,text: _('goodnews.newsletter_send_confirm')+' ('+_('goodnews.newsletter_recipients')+this.menu.record.openrecipients+')'
,url: GoodNews.config.connectorUrl
,params: {
action: 'mgr/send/start'
,nlid: this.menu.record.id
,nlaction: 'thisisnotest'
}
,listeners: {
'success': {fn:this.refresh,scope:this}
}
});
}
...
This question has been answered by markh. See the first response.
class MyCustomProcessor extends modProcessor {
public function process() {
// do your custom stuff
}
}
return 'MyCustomProcessor';Processors don't *have* to be class based, but I do recommend it. If you can extend the CRUD-based ObjectProcessors, you can use the following minimal class-based processor which for sure will work in many future versions to come (I'm not saying non-class-based processors will be gone from 2.3, but it could be something that is dropped in a 3.0 for example):
class MyCustomProcessor extends modProcessor { public function process() { // do your custom stuff } } return 'MyCustomProcessor';
Maybe you can post your processor (and its filename) to see if there may be an issue in that?
<?php
/*
we'd like to include our custom class which holds all the required methods to send the newsletters
- using this the processor throws an error
*/
//require_once('/var/www/modx/wwwRoot/modxdev/goodnews/core/components/goodnews/model/goodnews/mailpump.class.php');
/*
for testing:
if we try to use/call a simple function the processor throws an error
*/
function test() {
$modx->log(modX::LOG_LEVEL_INFO, 'GoodNews: start sending newsletter');
return;
}
$nlid = $scriptProperties['nlid'];
$nlaction = $scriptProperties['nlaction'];
//sendNL($nlid, $nlbulk = 30, $nlaction);
/*
for testing:
*/
test();
return $modx->error->success('');

/* Include the class */
require_once('/var/www/modx/wwwRoot/modxdev/goodnews/core/components/goodnews/model/goodnews/mailpump.class.php');
class MyCustomProcessor extends modProcessor {
/** @var MailPump $mailpump */
public $mailpump;
public function initialize() {
$this->mailpump = new MailPump();
}
public function process() {
$this->test();
$nlid = $this->getProperty('nlid');
$nlaction = $this->getProperty('nlaction');
// If the sendNL function is a method on the MailPump class, use that, otherwise you should just have sendNL().
// $this->mailpump->sendNL($nlid, 30, $nlaction);
// sendNL($nlid, 30, $nlaction);
return true;
}
public function test() {
$this->modx->log(modX::LOG_LEVEL_INFO, 'GoodNews: start sending newsletter');
}
}
return 'MyCustomProcessor';function test() {
$modx->log(modX::LOG_LEVEL_INFO, 'GoodNews: start sending newsletter');
return;
}function test() {
global $modx;
$modx->log(modX::LOG_LEVEL_INFO, 'GoodNews: start sending newsletter');
return;
}
...
,sendNewsletter: function(btn,e) {
MODx.msg.confirm({
title: _('goodnews.newsletter_send')
,text: _('goodnews.newsletter_send_confirm')+' ('+_('goodnews.newsletter_recipients')+this.menu.record.openrecipients+')'
,url: GoodNews.config.connectorUrl
,params: {
action: 'mgr/send/start'
,nlid: this.menu.record.id
,nlaction: 'thisisnotest'
}
,listeners: {
'success': {fn:this.refresh,scope:this}
}
});
}
...
<?php
require dirname(dirname(dirname(dirname(__FILE__)))) . '/model/goodnews/goodnewsmailing.class.php';
class GoodNewsStartMailingProcessor extends modProcessor {
/** @var GoodNewsMailing $goodnewsmailing */
public $goodnewsmailing;
public function initialize() {
$this->goodnewsmailing = new GoodNewsMailing();
return parent::initialize();
}
public function process() {
$nlid = $this->getProperty('nlid');
$nlbulk = 10;
$nlaction = $this->getProperty('nlaction');
$this->modx->log(modX::LOG_LEVEL_INFO, 'Debug: process() method of class GoodNewsStartMailingProcessor');
// send a bulk of mails
$this->goodnewsmailing->sendNL($nlid, $nlbulk, $nlaction);
return $this->modx->error->success('');
}
}
return 'GoodNewsStartMailingProcessor';
<?php
/**
* GoodNews Connector
*
* @package goodnews
*/
require_once dirname(dirname(dirname(dirname(__FILE__)))).'/config.core.php';
require_once MODX_CORE_PATH.'config/'.MODX_CONFIG_KEY.'.inc.php';
require_once MODX_CONNECTORS_PATH.'index.php';
$corePath = $modx->getOption('goodnews.core_path', null, $modx->getOption('core_path').'components/goodnews/');
require_once $corePath.'model/goodnews/goodnews.class.php';
$modx->goodnews = new GoodNews($modx);
$modx->lexicon->load('goodnews:default');
/* handle request */
$path = $modx->getOption('processorsPath', $modx->goodnews->config, $corePath.'processors/');
$modx->request->handleRequest(array(
'processors_path' => $path,
'location' => '',
));