Triggering onContentChangeState from task plugin?

23 views
Skip to first unread message

Ronny Buelund

unread,
Sep 29, 2024, 10:55:41 AM9/29/24
to Joomla! General Development
I have created a task plugin that unpublishes old articles. That works perfectly fin. I have another plugin that acts on the onContentChangeState- to trigger that plugin from the task I have added this code:

foreach($results as $result){
$article[0] = $result['id'];
PluginHelper::importPlugin('content');
$app = Factory::getApplication();
$app->triggerEvent('onContentChangeState', array('com_content.article', &$article, &$params, 0));
}

This works when I run the task as a test, but when it is triggered by the cron job, it fails ??? Why is that ??
I see this in the sceduler log:

2024-09-29 14:47:12 ERROR Rutine triggered exception: Invalid address:  (to):
2024-09-29 14:47:13 WARNING Opgave#03 afbrød med koden 5 i 0.00 (net 0.14) sekunder.

Ronny Buelund

unread,
Sep 29, 2024, 10:59:44 AM9/29/24
to Joomla! General Development
Sorry - was a bug in the plugin that acted on onContentChangeState  - verything works now as expected :-)
Reply all
Reply to author
Forward
0 new messages