Mautic Community Forums

Help on user login event

I try to extend mautic function with user login event and I got error message.



Fatal error: Class ‘MauticCoreBundleEventListenerLoginEvent’ not found in …/app/bundles/CoreBundle/EventListener/CoreSubscriber.php on line 130



This is config.php file.

Code:
return array( 'name' => 'Check Login', 'description' => 'This plugin to check user login with undecided role', 'version' => '1.0', 'author' => '',
'services'    => array(
    'events' => array(
        'check.login.subscriber'              => array(
            'class'     => 'MauticPluginCheckLoginBundleEventListenerLoginSubscriber'
        )
    )
)

);


This is CheckLoginBundle.php file.
Code:
namespace MauticPluginCheckLoginBundle;

use MauticPluginBundleBundlePluginBundleBase;
use MauticUserBundleEntityUser;

class CheckLoginBundle extends PluginBundleBase
{

}


This is LoginSubscriber.php file.
Code:
namespace MauticPluginCheckLoginBundleEventListener;

use MauticUserBundleUserEvents;
use MauticUserBundleEventLoginEvent;
use MauticCoreBundleEventListenerCommonSubscriber;
use MauticUserBundleEventListenerUserSubscriber;
use SymfonyComponentHttpKernelControllerControllerReference;
use MauticCoreBundleControllerCommonController;
use MauticUserBundleControllerUserController;

class LoginSubscriber extends UserSubscriber
{
public static function getSubscribedEvents()
{
return array(
UserEvents::USER_LOGIN => array(‘checkOnLogin’, 0)
);
}

public function checkOnLogin(LoginEvent $event)
{
	
}

}


Please help me.
Thanks

I try to extend mautic function with user login event and I got error message.

Fatal error: Class ‘MauticCoreBundleEventListenerLoginEvent’ not found in …/app/bundles/CoreBundle/EventListener/CoreSubscriber.php on line 130

This is config.php file.

[code]return array(
‘name’ => ‘Check Login’,
‘description’ => ‘This plugin to check user login with undecided role’,
‘version’ => ‘1.0’,
‘author’ => ‘’,

'services'    => array(
    'events' => array(
        'check.login.subscriber'              => array(
            'class'     => 'MauticPluginCheckLoginBundleEventListenerLoginSubscriber'
        )
    )
)

);[/code]

This is CheckLoginBundle.php file.

[code]namespace MauticPluginCheckLoginBundle;

use MauticPluginBundleBundlePluginBundleBase;
use MauticUserBundleEntityUser;

class CheckLoginBundle extends PluginBundleBase
{

}[/code]

This is LoginSubscriber.php file.

[code]namespace MauticPluginCheckLoginBundleEventListener;

use MauticUserBundleUserEvents;
use MauticUserBundleEventLoginEvent;
use MauticCoreBundleEventListenerCommonSubscriber;
use MauticUserBundleEventListenerUserSubscriber;
use SymfonyComponentHttpKernelControllerControllerReference;
use MauticCoreBundleControllerCommonController;
use MauticUserBundleControllerUserController;

class LoginSubscriber extends UserSubscriber
{
public static function getSubscribedEvents()
{
return array(
UserEvents::USER_LOGIN => array(‘checkOnLogin’, 0)
);
}

public function checkOnLogin(LoginEvent $event)
{
	
}

}
[/code]

Please help me.
Thanks

If I removed line 130 …/app/bundles/CoreBundle/EventListener/CoreSubscriber.php

$event = new LoginEvent($this->factory);

My plugin work.
Please explain on this.
Thanks