2013-07-26 23 views
1

編輯:現在它的工作,是LimeSurvey中的一個錯誤。Limesurvey 2.05插件

我爲LimeSurvey 2.05beta5創建了簡單的登錄插件只是爲了測試,如果它工作。

問題是,該事件newUserSession從不被調用。文檔也是非常糟糕的,因爲仍處於測試階段...

這裏是插件代碼:

<?php 
    class TestLogin extends AuthPluginBase 
    { 
     protected $storage = 'DbStorage';  

     static protected $description = 'Testing login system...'; 
     static protected $name = 'TestLogin'; 

     public function __construct(PluginManager $manager, $id) { 
      parent::__construct($manager, $id); 

      $this->subscribe('beforeLogin'); 
      $this->subscribe('newUserSession'); 
     } 

     public function beforeLogin() 
     {  
     if (isset($_GET["testlogin"]) && ($_GET["testlogin"] == 1)) { 
      $this->setUsername('admin'); 
      $this->setAuthPlugin(); 
     } 
     } 

     public function newUserSession() 
     { 
      $sUser = $this->getUserName();   
      $oUser = $this->api->getUserByName($sUser); 

      if (!is_null($oUser)) 
      { 
       $this->setAuthSuccess($oUser); 
       return; 
      } else { 
       $this->setAuthFailure(self::ERROR_USERNAME_INVALID); 
      }  
     } 
    } 
?> 

要調用這個代碼,只要進入這個網址:管理/認證/ SA /登錄? testlogin = 1

我錯過了什麼?

+0

請離開「現在的工作」作爲回答(見下文),並接受它,以便爲解決這個問題將被標記。另請參閱帶有標識符和/或鏈接的問題/故障單/更改集,以便保留參考。感謝您使本網站(和limesurvey)更好! – hakre

+0

LimeSurvey 2.05beta5 ....測試版是測試版 –

回答

相關問題