wpdirauth_usercreated

wpdirauth_usercreated

Description

Fires right after a new AD-authenticated user has been created in WordPress. This occurs either right after an ad-authed user has authenticated and Auto Register is enabled in the plugin, or when adding an AD-authenticated user from the Users panel.

Parameters

$intUserID
(integer) WordPress user ID of the newly created AD-authenticated user.

$aryUserDetails
(array) ListĀ of user details (see example). One key in the array will be ldap_entry and will be the search result from the ldap search.

Return

Your callback function does not need to return a value.

Example


/** 
* Add an AD-authenticated user's department and phone number to their WordPress User meta data 
*/ 
add_action('wpdirauth_usercreated',function($intUserID,$aryUserDetails){ 
    if(isset($aryUserDetails['ldap_entry']['telephonenumber'][0]) && '' != $aryUserDetails['ldap_entry']['telephonenumber'][0] ){ 
        add_user_meta($intUserID,'telephone',$aryUserDetails['ldap_entry']['telephonenumber'][0]); 
    } 

    if(isset($aryUserDetails['ldap_entry']['department'][0]) && '' != $aryUserDetails['ldap_entry']['department'][0] ){ 
        add_user_meta($intUserID,'department',$aryUserDetails['ldap_entry']['department'][0]); 
    } 
},10,2);