designbyfront/LDAP-Authentication-for-ExpressionEngine — Issue #11: No login events in CP Log
Author: diemer
Created: 2011-10-31 23:26:44+00:00
State: open

I noticed this extension isn't calling the logger function, and my Control Panel log was full of only log out events so I patched this in the login_authenticate_start function, after the `$this->sync_user_details($result);` line.

```php
$query = $this->EE->db->query("SELECT member_id FROM exp_members WHERE username ='".$this->EE->db->escape_str($result['username'])."' LIMIT 0, 1");

if ($query->num_rows() > 0)
{
foreach($query->result_array() as $row)
{
$this->EE->session->userdata['member_id'] = $row['member_id'];
$this->EE->session->userdata['username'] = $this->EE->db->escape_str($result['username']);
}
}

$this->EE->load->library('logger');
$this->EE->logger->log_action("Logged in via LDAP");
```