Hello,
I was previously working on this topic with Nigel but it took a long time to make progress.
https://toolset.com/forums/topic/importing-a-csv-user-data-to-new-site/
I have since been corresponding with WP All Import folks and they had the following suggestions:
--
Unfortunately, you can't retain the IDs as the new user's IDs since WordPress uses them as primary keys in the database. You'd need to save the old ID to a custom field and reference it there: hidden link
Continuing from the previous suggestion, you could use a custom PHP function to reference the old ID stored in the custom field & return the new user ID.
You would need to call the function in the "Post Author" field (found inside of the "Other Post Options" section; exchange "Post" for the name of your post type): hidden link
--
I am a novice with PHP and I am not sure what to do next.
Thank you
Hello, what exactly do you need from Toolset? Have you been able to complete this part of the process they described?
You'd need to save the old ID to a custom field
Once that is done, it sounds like the import plugin support team suggests you write a custom PHP function as described in their documentation here: http://www.wpallimport.com/documentation/advanced/execute-php/.
If you need something specific from Toolset to facilitate this, please let me know what that is. If you need general help using 3rd-party software or writing a custom PHP function to extend 3rd-party software, I suggest you contact their support team because Toolset's support team is not really the best source of information here. We are not trained in their system or the proprietary syntax for these custom manipulation functions, but their team should have all that information. Perhaps they have some example functions you could use as templates to complete this part of the process that doesn't really involve Toolset:
Continuing from the previous suggestion, you could use a custom PHP function to reference the old ID stored in the custom field & return the new user ID. You would need to call the function in the "Post Author" field (found inside of the "Other Post Options" section; exchange "Post" for the name of your post type)
Hi Christian,
I am a little stumped on saving an old ID to a custom field. I tried using the post ID in the export process, but then I am not sure I did it right.
Thank you
I am a little stumped on saving an old ID to a custom field.
You are trying to transfer content from site A to site B, correct? You want to save the User's ID from site A into a User profile custom field on site A, so you can then import those Users along with their old IDs into site B. Am I correct? If so, there's nothing built-in to Toolset that will accomplish this for you automatically. First you would set up the user custom field in Toolset > Custom fields > User fields. Then you would need a custom SQL or PHP script that loops over all Users and manipulates database values directly, which we do not recommend unless you are a skilled database developer.
Or if it's just a few Users, it might be more practical to spend an hour or two manually doing this in wp-admin. You can find each User's ID by going to Users > All Users. If you edit any User, you can find their user_id in the URL. You would copy that number into the user ID custom field and save the User, then when you import Users into site B, the old ID can be imported as a custom field on the User profile.
Another option would involve Toolset Forms and some manual data entry. Create an Edit User Form that displays only an input for the custom field and a submit button. Set the value of the custom field using the wpv-user shortcode ( https://toolset.com/documentation/user-guides/views-shortcodes/#vf-154505 ). Insert this Form in the loop of a View of all Users, and submit each Form to update the corresponding User profile. You would have to submit the Form for every User profile, so it's probably not practical with thousands of Users. But for a few hundred, it might be faster than going through wp-admin.
I am continuing to pursue the solution with WP All Import.