Page 1 of 1

How are cmsmadesimple events sent?

Posted: Wed Feb 19, 2014 3:09 pm
by darwin31
Hi,
I need help with cmsmadesimple events. I'm trying handle modules FrontEndUsers event OnLogin. This module initiates this event in method.install.php:

Code: Select all

$this->CreateEvent( 'OnLogin' );
In my Civicrm module method.instal.php I register OnLogin handler:

Code: Select all

$this->AddEventHandler( 'FrontEndUsers', 'OnLogin' );
So, lets start. FrontEndUser sends this event in action.do_login.php with:

Code: Select all

$parms = array();
$parms['id'] = $this->LoggedInId();
$parms['username'] = $params['feu_input_username'];
$parms['ip'] = cge_utils::get_real_ip();
$this->SendEvent( 'OnLogin', $parms );
$this->_SendNotificationEmail('OnLogin',$parms);
I do in CiviCRM module:

Code: Select all

public function DoEvent($originator, $eventname, &$params)
{
    if ($originator == 'FrontEndUsers' && $eventname == 'OnLogin')
        var_dump($params);
        die("feulogin");
    }
}
When you do front login, script is terminated as expected, but when trying to debug $params, got confused how event is send, because even commented out:

Code: Select all

//$this->SendEvent( 'OnLogin', $parms ); 
DoEvent()handles event as well (exits script with message).

Couldnt find any more code in FrontEndUsers where OnLogin event is sent, so please help me find out that.

Re: How are cmsmadesimple events sent?

Posted: Wed Feb 19, 2014 3:47 pm
by chandra
darwin31 wrote: CiviCRM module.
Sounds interesting... will this module be open source?

Re: How are cmsmadesimple events sent?

Posted: Thu Feb 20, 2014 11:09 am
by darwin31
Solved it myself. FrontEndUsers also sends event OnLogin in method 'Login'

Re: How are cmsmadesimple events sent?

Posted: Fri Feb 21, 2014 7:43 pm
by chandra
chandra wrote:
Sounds interesting... will this module be open source?
Bump

Re: How are cmsmadesimple events sent?

Posted: Sun Feb 23, 2014 9:59 am
by darwin31
chandra wrote:
chandra wrote:
Sounds interesting... will this module be open source?
Bump
Hi chandra, of cource it's open source module, but in alpha stage yet.