User import
Home › Forums › GovIntranetters › User import
Tagged: csv, import, staff directory, users
- This topic has 10 replies, 3 voices, and was last updated 10 years ago by
deanodley.
-
AuthorPosts
-
-
10 Mar 2015 at 23:14 #1717
deanodley
ParticipantUpdate: I’ve made some progress by using the plugin “CSV Importer for Pods” found here https://wordpress.org/plugins/csv-importer-for-pods/.
It will create users from the CSV file and will and populate fields in wp_metadata and also in wp_users. What is doesn’t do is populate the “first_name”, “last_name” and “description” meta keys in wp_metadata. This means that while the user can be displayed by department, any search by name will fail. -
11 Mar 2015 at 11:01 #1718
colshaw
ParticipantWe are using version 4/ACF and used the plugin “Import users from CSV with meta” to import our users and if I recall correctly the only data we couldn’t import was line manager.
-
11 Mar 2015 at 11:28 #1719
deanodley
ParticipantThanks colshaw. So far I’ve used a similar plugin, “import users from csv”. I run this right after the pods csv importer with a modified csv. It will amend the user with the missing data. I need to test it a little more but it looks promising. The last issue I have is with the user’s forum role. This appears to be encoded in the wp_capabilities metakey in wp_usermeta. This can easily be updated with an sql query via php but I’d like to find a more user-friendly solution!
-
11 Mar 2015 at 11:42 #1720
colshaw
ParticipantThe plugin I mentioned above sets the forum role per import so we imported a csv with our “subscribers” then the authors etc. As your hands on with the WP backend you will no doubt end up with a more versatile solution but we needed the plugin otherwise it was going to be a manual task or launch the intranet and ask everyone to just register.
Good luck!
-
11 Mar 2015 at 11:49 #1721
deanodley
ParticipantCool. Maybe It will work out for me to substitute your user import plugin for mine.
I would be very interested to know the fields you used in the csv. How did you target the “forum role” field? I assume your import did not overwrite the wordpress role, but amend the forum role to it? They are stored in the same database key BTW. -
11 Mar 2015 at 12:11 #1722
colshaw
ParticipantSorry deanoldey I meant WP user role not forum role.
-
16 Mar 2015 at 01:15 #1734
Luke Oatham
KeymasterI’ve uploaded a rough and ready importer plugin that I’ve used before, which you can adapt as necessary. There are 2 importers, a simple team importer to run first, and a user importer to run second which can tie into the teams.
This requires you to create 2 spreadsheets using columns as specified below, export each spreadsheet to a CSV file, open the CSV in a TEXT EDITOR, copy the rows and paste into the converter (found under Tools). Don’t leave a blank at the end of the pasted contents.Teams:
// [0] team name
// [1] parent nameUsers:
// [0] first_name
// [1] last_name
// [2] Nickname
// [3] Team name
// [4] Email
// [5] Phone
// [6] Mobile
// [7] Working pattern
// [8] Job title
// [9] Role/bio
// [10] Line manager
// [11] Skills
// [12] More bio -
20 Mar 2015 at 02:00 #1735
deanodley
ParticipantHi Luke – thanks for the plugin upload.
I’ve imported the teams I need using the first plugin, with no parent defined for each.
They all appear correctly under Settings | TeamsHowever, the user importer throws the error – “Can’t find sub team xxx”.
I can see in the code that $tterm = get_page_by_title($team, OBJECT, ‘team’);
However, a quick check is_null($tterm) returns TRUE.Any ideas or pointers as to why it is failing?
Thanks, Dean -
15 Apr 2015 at 16:38 #1751
Luke Oatham
KeymasterHi Dean – did you have any luck with this? Just wondering if it’s a simple case of a blank line at the end of the content that you pasted?
-
11 May 2015 at 13:55 #1765
deanodley
ParticipantHi Luke – yes the team import worked fine but the user import did not. This could have something to do with the fact that I was using v3 of the theme with Pods. In the end, I wrote a PHP script to read in the CSV file and populate the sql tables, wp_user, wp_usermeta and wp_podsrel so that everything worked OK.
Thanks, Dean
-
-
AuthorPosts
- You must be logged in to reply to this topic.