I have the following plugin written:
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
class plgContentModifyArticle extends JPlugin
{
function plgContentModifyArticle ( &$subject, $params )
{
parent::__construct( $subject, $params );
}
function onBeforeContentSave( &$article, $isNew )
{
echo "Can you see this?";
global $mainframe;
$newText = '<b>Testtext</b>';
$user =& JFactory::getUser(); // get the user
$article->fulltext.=$newText;
$article->introtext.=$newText;
return true;
}
}
With the following xml-file:
<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" version="3.1.0" group="content">
<name>Modifyarticle</name>
<version>1.0.0</version>
<description>Modify your articles</description>
<files>
<filename plugin="modifyarticle">modifyarticle.php</filename>
</files>
<install>
</install>
</extension>
I've made all of this based on the following tutorial: https://docs.joomla.org/J3.x:Creating_a_content_plugin
Unfortunately, it doesn't add text to a new article. And I don't have any idea on how to debug this.