我正在尝试创建一个Joomla1.7内容插件,最终,在后端创建一篇全新文章时,它将发送一封电子邮件。我的插件,虽然安装正确,但似乎没有正常运行。我对插件进行了修改,以便在创建新文章时,取消保存事件并显示错误消息。这是不可能的,文章也保存得很好。我是不是漏掉了什么明显的东西?我甚至尝试在die()方法中添加一个onBeforeContentSave()和mail()命令,但是它没有被执行。
notifyy.xml
<?xml version="1.0" encoding="utf-8"?>
<extension version="1.7" type="plugin" group="content">
<name>Content - Notifyy</name>
<author>Andy Soell</author>
<creationDate>August 1, 2011</creationDate>
<copyright></copyright>
<authorEmail>my@email.com</authorEmail>
<authorUrl>http://andy.teamsoell.com</authorUrl>
<version>1.0</version>
<description>Notification for new articles</description>
<files>
<filename plugin="notifyy">notifyy.php</filename>
</files>
</extension>notifyy.php
jimport( 'joomla.plugin.plugin' );
class plgContentNotifyy extends JPlugin {
function plgContentNotifyy( &$subject, $params )
{
parent::__construct( $subject, $params );
}
function onBeforeContentSave( &$article, $isNew )
{
global $mainframe;
$article->setError("i don't want to save this");
return false;
}
}发布于 2011-08-02 03:11:34
我觉得很傻,但Joomla的站点确实需要更好地记录它们在不同版本之间的更改。方法名似乎已从1.5版更改为1.6版,它们的文档仍显示1.5种名称。现在将onBeforeContentSave()方法作为onContentBeforeSave()引用。
更多详情见:http://www.theartofjoomla.com/converting-old-extensions.html
发布于 2011-08-27 15:33:24
文档确实包含关于重命名事件的信息。
请参阅:http://docs.joomla.org/Adapting_a_Joomla_1.5_extension_to_Joomla_1.6#Renamed_events
https://stackoverflow.com/questions/6906776
复制相似问题