# Configuring the WordPress Connector
To configure the WordPress Connector use the admin snap-in DAM/WordPress Connector
in the administration area. All changes made here will be stored in the XML file wordpress
in your folder custom/global/config
.
# Required fields
The following fields are required fields to configure:
field | description |
---|---|
Connector name | name of the connector we created previously |
WordPress base URL | full REST-URL for the WordPress server example: https://example.com/index.php/wp-json/wp/v2 |
WordPress username | your WordPress username |
WordPress password | your WordPress password |
Default download profile | default download profile of all file types |
Trigger fields | specify 4allportal fields to trigger the WordPress connector in case of update or creation required: ois_prev_type and wordpress_enabled |
Trigger conditions | push / update the file where all the conditions equals true, else delete it (from wordpress) |
# Additional configuration options
Additionally, you have the option to configure special download profiles and map fields from the 4ALLPORTAL to WordPress.
# Download profiles and field mapping for selected filetypes
Select filetypes that should not be downloaded with the default download profile or default field mapping set above, and map them to another download profile and / or field mapping using JSON values.
- Click the +-button to create a new entry.
- Specify the filetype
- Specify the JSON value. You can use two parameters:
derivate
: a string for the derivate typefieldMapping
: a string array for remapping the default field mapping or passing a new field mapping
Example for JSON value:
{
"derivate": "original",
"fieldMapping": {
"name": "description"
}
}
The JSON value can also contain only the derivate type in case you don't want to specify field mapping:
{ "derivate": "original" }
# Individual trigger configuration
If you want to configure individual triggers, you can add the following fields to the trigger field configuration
Value | Description |
---|---|
file_hash | syncs the file with WordPress with every change of its content, e.g. after restoring a file version with the versioning function or after editing the file with an editor |
parent_path | syncs the file with WordPress with every change of its parent path, e.g. when you move the file to another folder or rename the current folder path |
name | syncs the file name with WordPress with every change of the file name in the 4ALLPORTAL |
wordpress_enabled * | syncs the file with WordPress with every change of the "Share with WordPress" switch (enable / disable) |
ois_prev_type * | required trigger field for derivate synchronization. Do not delete! |
release_status (example) | any individual field to manage usage rights. Syncs the file with WordPress with every change of its digital rights status |
- Trigger set by system default
Please note: Clear the configuration cache of the 4ALLPORTAL to submit your configuration.
# Trigger condition to consider Digital Rights
Basically the WordPress Connector ignores the usage rights of files when sharing with WordPress. If you want to consider a file's rights, create a trigger condition to check the digital rights status when the trigger is executed.
Add a condition that must be met in order to share a file with WordPress to field
Trigger conditions
.For example if you want to allow users to share "unlocked" files, enter this:
`file`.`release_status` = 'unlocked'
release_status
: Use the metadata field name for digital rights, e.g. "release_status.xml".- 'unlocked': Use the value option key for digital rights status, e.g. "<key>unlocked</key>".
Save your changes in the toolbox and clear the configuration cache once.
Change of status trigger: If you want to sync files depending on a change of the digital rights status, you can enter the field e.g. "release_status" to the trigger field configuration. See chapter Individual trigger configuration above.
Please note: The value of the trigger "wordpress_enabled" has to be "true". So files can only be shared if the digital rights status is "unlocked". Otherwise, you cannot share files or existing files will be deleted from the WordPress media library.
# Field mapping
Choose fields from your 4ALLPORTAL and map them to WordPress fields here using the +-button to create a new connection.
After the configuration, save your changes in the toolbox and clear the configuration cache once.
# Reference: Basic configuration file
The basic configuration file wordpress-connector.xml
is stored in the connector's 4App folder modules/<module_name>/connectors
and looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<connector>
<connector_name>wordpress-connector</connector_name>
<type>bean</type>
<paps>
<pap class="com.cm4ap.ce.pap.wordpress.WordpressConnector" key="upload">
<parameters>
<entry key="url"/>
<entry key="username"/>
<entry key="password"/>
<entry class="map" key="fieldMapping">
<entry key="name">title</entry>
</entry>
</parameters>
</pap>
</paps>
<conditions/>
<trigger_fields>
<trigger_field>wordpress_enabled</trigger_field>
</trigger_fields>
<derivates>
<derivate>original</derivate>
</derivates>
<general_mam_role>pap</general_mam_role>
</connector>
Note: The conditions in the connector should remain unchanged.