Ok, so how do you use the hooks to make a mod which can use and extend ldap_auth?
Roughly like this:
- Set a plugin on hook ldap_auth_start which adds the additional LDAP attributes you'll be using to the array $ldapAttrs.
- Choose when you want to use the attributes:
- If you want to use them every time a user logs in, plug in at hook ldap_auth_all_user
- If you only want to use them if the user has never logged in before choose ldap_auth_new_user
- If you want to use them only if the user HAS logged in before, choose ldap_auth_existing_user
- Whichever hook (or hooks) you choose the process is the same:
- If you want to add data to the user, you'll find the users datamanager object in the variable $newuser
- If you want to set a value into the users profile fields, then you just need to set that value into the array $userFields with the key being the field name
There are, of course, many other things you could choose to do in your plugin, for example if you call the standard_error function, you'll display a nice error message page (For example if the user has a flag denoting the account is disabled)
HOWEVER you need to call
process_logout() first as the user will be partly logged in (If their account already exists in vBulletin).
Examples of this can be found in the
LDAP Authentication plugin in this mod, or in the
Full Name Support for LDAP Auth and
Location Support for LDAP Auth mods (Coming soon).
Hope this helps
Haqa...