event onUserAuthorisation에서 일부 데이터베이스 쿼리를 만들기 위해 플러그인을 만들려고합니다. 지금은 플러그인 기능이 제대로 실행되고 있는지 확실하지 않기 때문에 "Hello World"스타일 플러그인을 설정하려고합니다. 새 사용자가 승인을 받으면 플러그인에서 이메일을 보내야합니다.사용자 onUserAuthorisation 용 플러그인 "Hello World!"
나는 사용자 등록과 관리를 위해 joomla 이메일이 작동하는지 확인할 수 있습니다.
파일 : autoextranet.php
, autoextranet.xml
, index.html
(빈)
autoextranet.php
<?php
// no direct access
defined('_JEXEC') or die;
class plgUserAutoextranet extends JPlugin
{
public function onUserAuthorisation($user, $options)
{
$mailer = JFactory::getMailer();
$config = JFactory::getConfig();
$sender = array(
$config->get('mailfrom'),
$config->get('fromname')
);
$mailer->setSender($sender);
$recipient = array('[email protected]', '[email protected]');
$mailer->addRecipient($recipient);
$body = "New User: ".$user->username;
$mailer->setBody($body);
$mailer->setSubject('You got a new user.');
$mailer->Send();
}
}
?>
autoextranet.xml
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.8.2" type="plugin" group="user">
<name>PLG_USER_AUTOEXTRANET</name>
<author>Tim DeLise</author>
<creationDate>Nov 14, 2017</creationDate>
<copyright>Tim D</copyright>
<license>GNU General Public License</license>
<authorEmail>your email</authorEmail>
<authorUrl>your website</authorUrl>
<version>1.0</version>
<description>.</description>
<files>
<filename plugin="autoextranet">autoextranet.php</filename>
<filename>index.html</filename>
</files>
</extension>
문제는 지금 설치하고 플러그인을 활성화 한 것입니다
. 새 사용자를 만들고 활성화하면 아무 것도 얻지 못합니다.
불행히도 저는 서버에 대한 액세스가 제한되어 있으며 PHP 오류 로그를 볼 수 없었습니다. 이벤트가 내 코드를 실행하고 있는지 확인하는 방법을 찾고 있습니다. 어떤 제안이라도 환영합니다. 또한 이것은 내가 만든 첫 번째 플러그인이므로 내 파일에 문제가있을 수 있습니다.
도움을 주시면 대단히 감사하겠습니다. 사용자가 로그인 과정에서 일단
줌라 버전 3.8.2
로컬 개발 환경에서 작동합니까? –
@SvenBluege 큰 포인트입니다. –
사용자가 실제로 사이트에 로그인하려고 시도 할 때까지이 이벤트가 시작되지 않는다는 것을 깨달았습니다. 테스트를 진행할 때 마지막 단계를 완료하지 않아서 이벤트가 실행되지 않았습니다. –