Last modified by MammaMia - 7 months ago
680 Views
2 min read

Mapping Microsoft Active Directory/LDAP server fields to your WordPress plugin

To synchronize a Microsoft Active Directory/LDAP field value to your WordPress plugin field, you must create a mapping. A mapping is an individual data synchronization instruction.

Each mapping is evaluated at the run time to assure the data is moved correctly from a Microsoft Active Directory/LDAP server source to the target plugin entity.

To complete a mapping, you must select a target WordPress field, the primary LDAP field and optionally one to many secondary LDAP field(s).

If you want to set a constant value for a WordPress field, you can use "Use Default Value Only" option of the primary LDAP field dropdown and set a default value for the mapping.

Before you map fields, it is important to follow the best practices below.

Mapping for unique and required values

  • Blue color indicates a required field. Any Microsoft Active Directory/LDAP field value corresponding to this field cannot be empty or null. You must have a mapping created for all required fields.
  • Red color indicates a unique field. Any Microsoft Active Directory/LDAP field value corresponding to this field cannot have duplicate values. For example, every employee must have a unique employee number or username. There cannot be another employee with the same employee number or username. You must have a mapping created for all unique values.

Creating WP Author field mapping

  • WP Author is mapped to WordPress admin user by default.
  • WP Author can be mapped to a field corresponding to a WordPress username or user email.
  • If Microsoft Active Directory/LDAP username value is empty, null or does not exist in WordPress, the default WP Author value on the import tab is used. In the IMPORT tab, you can set the default value to whichever WordPress user you prefer.

Setting custom field mapping

  • To map a custom LDAP field which is not listed in the dropdown, enter the field name in the textbox after clicking on the dropdown and then selecting it.
  • To sync a custom field which does not exist in WordPress or listed in the WordPress field dropdown, pick "Custom Field Placeholder".

Setting default values

  • To set a default value for a field, select the "Use Default Value Only" option from the Primary LDAP field column and fill in the corresponding "Default Value" field.
  • To set a value for an incoming empty or null LDAP field value, fill in the corresponding "Default Value" field.
  • To set a default value for an image or file field, fill in the default value field with the URL of the image or file.
  • To set a default date value, the date format must be in YYYY-MM-DD such as 2019-12-20.
  • To set a default value for a relationship field, you must find the POST ID of the entity record corresponding to that relationship. For example, if you'd like to set all employees who do not have a manager set in your Microsoft Active Directory/LDAP server to a manager, fill in the "Default Value" field to the POST ID of the manager employee record.
  • To set a default value for a taxonomy field, you must fill in the SLUG of that taxonomy in the corresponding "Default Value" field.

Secondary LDAP fields

You can set one to many secondary LDAP fields in your mapping to provide a fall back value for the corresponding primary LDAP field.

If the primary LDAP field of a mapping is empty or null, Microsoft Active Directory/LDAP addon checks the secondary LDAP field(s) to see any value available to assign.

If multiple secondary fields are set, the value assignment is based on the order of the secondary field(s). For example if you select field A first and then field B, the value check is completed based on the field A first then the field B.

If the secondary field(s) and the default value of a mapping are both filled out, the value of a set secondary LDAP field(s) gets validated first before the default value is assigned.

Was this information helpful?