Jump to content

Registering Users.login And Users.logout Events


Recommended Posts

Posted

Hello,

 

I try to implement a plugin that would integrate Blesta with our system and I would like to use callbacks: "Users.login" and "Users.logout" (http://docs.blesta.com/display/dev/Event+Handlers). I tried to register these two events as follows:

 

class MyPlugin extends Plugin {

...

public function getEvents() {
 return array(
   array(
      'event' => "Appcontroller.preAction",
      'callback' => array("this", "run")
   ),
   array(
      'event' => "Users.login",
      'callback' => array("this", "userWasLoggedIn"),
   ),
   array(
     'event' => "Users.logout",
     'callback' => array("this", "userWasLoggedOut")
   )
  );
}

// This method IS called.
public function run($event) {


        echo "run -- method";      
}

// This method is NOT called.
public function userWasLoggedIn($event) {


          var_dump("in", $event);
          throw new \Excepion("aaa");
}

// This method is NOT called.

public function userWasLoggedOut($event) {          
     var_dump("out", $event);          
    throw new \Excepion("sss");
}

}

 

The problem is that the methods userWasLoggedIn and userWasLoggedOut are not called when a user submits form located at https://blesta.domain.com/client/login/

 

http://docs.blesta.com/display/dev/Event+Handlers - I've just noticed that the events are available since version 3.1. Does it mean that the events will be available in the next release of Blesta? As far as I know the last released version is 3.0.5.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...