wpdirauth_userauthenticated

wpdirauth_userauthenticated

Description

Fires right after an ad-authenticated user has authenticated.

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


/** 
* Update a user's phone number if they've updated it in AD, or add it here if they've added it in AD 
*/ 
add_action('wpdirauth_userauthenticated',function($intUserID,$aryUserDetails){ 
    $strOldPhone = get_user_meta($intUserID,'telephone',true); 

    if(isset($aryUserDetails['ldap_entry']['telephonenumber'][0]) && '' != $aryUserDetails['ldap_entry']['telephonenumber'][0] ){ 
        if($strOldPhone != $aryUserDetails['ldap_entry']['telephonenumber'][0]){ 
            update_user_meta($intUserID,'telephone',$aryUserDetails['ldap_entry']['telephonenumber'][0],$strOldPhone); 
        } 
    } 
},10,2);