next_ad_int_sync

wp2ad_filter_synchronizable_users

next_ad_int_sync_wp2ad_filter_synchronizable_users (array $users, int $userId = null) : array $users

Filter users which shall be synchronized from WordPress to Active Directory

Description

The callback is executed after all synchronizable users have been loaded from the WordPress database

Return value

array $users

An array with the users to be synchronized to Active Directory.

Parameters

array $users

Array with users which are synchronized afterwards to Active Directory.

int $userId = null

If only a single user should be synchronized (e.g. after changing the user’s profile) this is the ID of the requested profile. If this is not null the array contains only one element.

wp2ad_filter_synchronizable_attributes

next_ad_int_sync_wp2ad_filter_synchronizable_attributes (array $attributesToSync, WP_User $wpUser, array $allowedAttributes): array $attributesToSync

Get final attributes which should be synchronized to Active Directory

Description

This filter is applied after next_ad_int_sync_wp2ad_filter_synchronizable_users for each user. It delegates to the designated LDAP functions. You can manually add custom attributes which should always synchronized to the Active Directory. In the most cases you want to implement such a mapping by using the NextADI administration interface.

Return value

array $attributesToSync

An associative array with key => Active Directory attribute and value => Current WordPress value.

array $attributesToSync

Associative array with Active Directory attributes to WordPress values which should be synchronized.

Parameters

WP_User $wpUser

WordPress’ user object of user to be synchronized.

array $allowedAttributes

List with attribute which are defined by the administrator as synchronizable.

wp2ad_after_user_synchronize

next_ad_int_sync_wp2ad_after_user_synchronize (int $syncStatus, WP_User $wpUser, array $attributesToSync, array $allowedAttributes)

The action is executed after the LDAP write query has been finished.

Description

This filter is applied after next_ad_int_sync_wp2ad_filter_synchronizable_attributes and after the LDAP write request has been finished.

Parameters

int $status

0 = failed, 1 = ok

WP_User $wpUser

WordPress’ user object of synchronized user.

array $attributesToSync

Associative array with Active Directory attributes to WordPress values which have been synchronized.

array $allowedAttributes

List with attribute which are defined by the administrator as synchronizable.

ad2wp_filter_synchronizable_users

next_ad_int_sync_ad2wp_filter_synchronizable_users (array $users) : array $users

Filter users which shall be synchronized from Active Directory to WordPress.

Description

The callback is executed after all synchronizable users have been loaded from the Active Directory (based up security group membership) and WordPress (local GUID information).

Return value

array $users

An array with the users to be synchronized to Active Directory. Associative array with key => object GUID, value => userPrincipalName or guid.

Parameters

array $users

Associative array with key => object GUID, value => userPrincipalName or guid. All entries are read from the Active Directory and synchronized to WordPress

ad2wp_filter_synchronizable_attributes

next_ad_int_ldap_filter_synchronizable_attributes (array $attributeNames, string $username, boolean $isGUID) : array $attributeNames

Get final attributes which should be synchronized to WordPress

Description

This filter is applied after next_ad_int_sync_ad2wp_filter_synchronizable_users for each user. You can add or unset custom LDAP attributes which should be (or not be) retrieved from the Active Directory.

Return value

array $attributeNames

An array containing Active Directory attribute names

Parameters

array $attributeNames

This array contains the Active Directory attributes which has been defined by plug-in itself and the NADI administrator. You should not unset any of the internal attributes like ‘objectguid’.

string $username

GUID, sAMAccountName or userPrincipalName

bool $isGUID

if $username is a GUID

ad2wp_clean_existing_roles

next_ad_int_sync_ad2wp_clean_existing_roles (array $wordPressRoles, WP_User $wpUser, NextADInt_Adi_Role_Mapping $roleMapping) : bool $cleanExistingRoles

Clean existing role of user before his role mapping is applied.

Description

This filter is applied after the mapping for Role Equivalent Groups has been done and before the update of the WordPress roles itself has happened.

Return value

bool $cleanExistingRoles

If true (default), all existing roles of the user are removed before updating his values. If you set it to false you can implement a custom behavior on your own.

Parameters

array $wordPressRoles

WordPress roles to update. These are basically the roles from NextADInt_Adi_Role_Mapping::getWordPressRoles() or ‘subscriber’ if no role could be assigned.

WP_User $wpUser

User to update

NextADInt_Adi_Role_Mapping $roleMapping

Determined mapping of Role Equivalent Groups.

ad2wp_filter_roles

next_ad_int_ad2wp_filter_roles (array $wordPressRoles, bool $cleanExistingRoles, WP_User $wpUser, NextADInt_Adi_Role_Mapping $roleMapping) : array $wordPressRoles

Get roles to synchronize for user.

Description

This filter is applied after the mapping for Role Equivalent Groups has been done and before the update of the WordPress roles itself has happened.

Return value

array $wordPressRoles

An array containing valid WordPress roles. Roles unknown to WordPress are discarded.

Parameters

array $wordPressRoles

WordPress roles to update. These are basically the roles from NextADInt_Adi_Role_Mapping::getWordPressRoles() or ‘subscriber’ if no role could be assigned.

bool $cleanExistingRoles

By default every existing role of the user will be removed.

WP_User $wpUser

User to update

NextADInt_Adi_Role_Mapping $roleMapping

Determined mapping of Role Equivalent Groups.

ad2wp_filter_user_before_synchronize

next_ad_int_sync_ad2wp_filter_user_before_synchronize (NextADInt_Adi_User $adiUser, NextADInt_Adi_Authentication_Credentials $credentials, NextADInt_Ldap_Attributes $ldapAttributes): NextADInt_Adi_User $adiUser

The filter is executed before the intermediate user object is created or updated.

Description

The filter is only executed if the user account can be synchronized, e.g. the Active Directory user is not disabled. In contrast to the synchronization from WordPress to Active Directory, the synchronization form Active Directory to WordPress is more complex.

Return value

NextADInt_Adi_User $adiUser

Intermediate user object which contains any value to be synchronized.

Parameters

NextADInt_Adi_User $adiUser

Intermediate user object which contains any value to be synchronized.

NextADInt_Adi_Authentication_Credentials $credentials

Contains context information about the mapping between Active Directory and WordPress user.

NextADInt_Ldap_Attributes $ldapAttributes

List with LDAP attributes provided by the Active Directory.

ad2wp_after_user_synchronize

next_ad_int_sync_wp2ad_after_user_synchronize (int $syncStatus, NextADInt_Adi_User $adiUser, NextADInt_Adi_Authentication_Credentials $credentials, NextADInt_Ldap_Attributes $ldapAttributes)

The action is executed after the LDAP write query has been finished.

Description

This filter is applied after next_ad_int_sync_ad2wp_filter_user_before_synchronize and any WordPress create or update has been executed. A natural usage of this hook is to persist binary data from Active Directory like photos on the local storage.

Parameters

int $status

-1=error, 0 = created, 1 = updated

NextADInt_Adi_User $adiUser

Intermediate user object which contains any synchronized value.

NextADInt_Adi_Authentication_Credentials $credentials

Contains context information about the mapping between Active Directory and WordPress user.

NextADInt_Ldap_Attributes $ldapAttributes

List with LDAP attributes provided by the Active Directory.