Background
Starting in Prime Mover 2.0.2, a new feature called custom user adjustment was introduced. This allows you to adjust non user_id
database columns during export and restore.
If you still don’t understand this feature, this article will clarify your doubts and explain its importance. First, let’s show an example of how the Prime Mover user adjustment feature works.
user_id
are adjusted by default
Prime Mover plugin auto-adjusts user_id
columns since version 1.9.7. Supposing you have a table named as hobbies
in your source site database:
ID | user_id | hobbies |
1 | 56 | singing |
2 | 57 | dancing |
Looking at the table, you will know that user_id 56 has a hobby of singing while user_id 57 has a dancing hobby. A third-party plugin could create these types of database tables. The user_id also corresponds to the WordPress user ID in the wp_users
table.
If you migrate your source site to another site installation, the user IDs of these users will change. This is because the site database is fresh, and no users are still added. It could also be that there are already many existing users in the target site and that Prime Mover adds new users to that target site during the migration (like when you migrate to a multisite with already existing users).
Once the above table is migrated and re-created in the target site database, Prime Mover auto-adjusts the user_ids to their new and correct user_ids on the target site. Supposing user_id 56 now becomes user_id 312 and user_id 57 becomes user_id 313. The table at the target site becomes:
ID | user_id | hobbies |
1 | 312 | singing |
2 | 313 | dancing |
As a result of the auto-user ID adjustment, your data’s integrity remains intact. So, user ID 56 (now user ID 312) still corresponds to the hobby of singing, and user ID 57 (now user ID 313) still corresponds to the hobby of dancing. This automatic user ID adjustment preserves the relationship between your user_id and their corresponding hobby.
This has been implemented since Prime Mover 1.9.7, only if the column is user_id. Otherwise, it is not auto-adjusted simply because Prime Mover does not know if your database columns refer to user_id data. It is impossible for a plugin to auto-determine that!
Non-user ID column adjustment feature
A custom user ID feature has been added to Prime Mover 2.0.2 to address the above limitations. This feature is available in both FREE and PRO versions. This is how it works. Supposing that instead of user_id
column, you have a column named as fan_id
in the table named as wp_band_fans
.
ID | fan_id | favorite_band |
1 | 24 | Beatles |
2 | 25 | Led Zeppelin |
Looking at the above table, the column fan_id
corresponds to the user ID
in the WordPress users table. So, a fan_id
of 24
also corresponds to a user with a WordPress user ID of 24
. It’s just that a third-party plugin chose to name the column fan_id
and not user_id
for specific reasons.
In version Prime Mover 2.0.2+ – you can define this user adjustment by doing the following:
- Log in as administrator or network administrator (if multisite).
- Make sure you are updated to at least Prime Mover 2.0.2.
- Go to Prime Mover -> Toolbox.
- If multisite – enter the blog ID of the subsite where you would like to adjust.
- Scroll down to the bottom; see the Export-Import Utilities setting section.
- You should see the Non-user_id column auto-adjustment text area settings.
- Define the settings one table per row as follows (using the above example)
It should be in this format: TABLENAME : COLUMN_NAME
Make sure that the following rules are followed:
- The table should exist in the database.
- The column name should exist in the database.
- If you like to enter multiple column names in a specific table, separate it with a comma like:
TABLENAME : COLUMN_NAME1, COLUMN_NAME2
- The column name should not be
user_id
. This is already handled automatically. - The table name should already include the database table prefix.
- In multisite, enter the table name in the toolbox setting corresponding to the correct blog ID. For example, if the table
wp_6_my_table
is the target table andmy_column
is the target column name for which the table belongs to blog ID 6. Enter that only to Prime Mover -> Toolbox -> Enter blog ID (enter six as blog ID) -> scroll down to Export-Import Utilities -> Non-user_id column auto-adjustment and define the settings there. This is to avoid entering the incorrect tables for the corresponding blog ID. - Finally, save the settings. Prime Mover will validate the settings and only save them if they are correct.
Once the settings are saved, you can proceed to create an export. The package will include instructions for the target site to auto-adjust user columns that do not use the user_id column name.
What happens on the restore site with custom user adjustment implementation?
When a package includes custom user adjustment implementation and is migrated to the target site – this is what will happen:
- Prime Mover restores the package.
- It then restores the database and all users from the source site to the target site.
- Prime Mover checks if the package includes custom user adjustment implementation.
- Prime Mover will auto-adjust these columns if applicable.
Therefore, the above table will look like the following (supposing fan_id: 24
it has a new user ID of 5 in the target site and fan_id
: 25
has a new user ID
of 6
).
ID | fan_id | favorite_band |
1 | 5 | Beatles |
2 | 6 | Led Zeppelin |
As you can see, the fan_id information still corresponds correctly to their favorite band (as it was set on the source site) because of the custom user adjustment feature, even though their user_ids have been changed on the target site.
Questions on this feature?
Please get in touch with technical support. Thank you!
Last updated: November 30, 2024