Skip to content

Latest commit

 

History

History
30 lines (20 loc) · 1.04 KB

WordPressUserSource.md

File metadata and controls

30 lines (20 loc) · 1.04 KB

WordPress User Source

The UXDM WordPress user source allows you to source user data and user meta data from a WordPress database.

Creating

To create a new WordPress user source, you must provide it with a PDO object that points towards the WordPress database.

The following example creates a new WordPress user object for a wordpress database on the localhost with username root and password password123. It then creates a WordPress user source object, using the newly created PDO object.

$pdo = new PDO('mysql:dbname=wordpress;host=127.0.0.1', 'root', 'password123');
$wordPressUserSource = new WordPressUserSource($pdo);

If you wish, you can also change the table prefix, as shown below. If not changed, it defaults to wp_.

$wordPressUserSource->setTablePrefix('wp2_');

Assigning to migrator

To use the WordPress user source as part of a UXDM migration, you must assign it to the migrator. This process is the same for most sources.

$migrator = new Migrator;
$migrator->setSource($wordPressUserSource);