code/extensions/LDAPMemberExtension.php
public function onBeforeWrite()
    {
        if ($this->owner->LDAPMemberExtension_NoSync) {
            return;
        }

        $service = Injector::inst()->get('LDAPService');
        if (
            !$service->enabled() ||
            !$this->owner->config()->create_users_in_ldap ||
            !$this->owner->Username ||
            $this->owner->GUID
        ) {
            return;
        }

        $service->createLDAPUser($this->owner);
    }
public function onBeforeWrite()
    {
        if ($this->owner->LDAPMemberExtension_NoSync) {
            return;
        }

        $service = Injector::inst()->get('LDAPService');
        if (
            !$service->enabled() ||
            !$this->owner->config()->create_users_in_ldap ||
            !$this->owner->Username ||
            $this->owner->GUID
        ) {
            return;
        }

        $service->createLDAPUser($this->owner);
    }
Create the user in LDAP, provided this configuration is enabled
and a username was passed to a new Member record.