User import

Home Forums GovIntranetters User import

Viewing 9 reply threads
  • Author
    Posts
    • #1717
      deanodley
      Participant

      Update: 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.

    • #1718
      colshaw
      Participant

      We 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.

    • #1719
      deanodley
      Participant

      Thanks 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!

    • #1720
      colshaw
      Participant

      The 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!

    • #1721
      deanodley
      Participant

      Cool. 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.

    • #1722
      colshaw
      Participant

      Sorry deanoldey I meant WP user role not forum role.

    • #1734
      Luke Oatham
      Keymaster

      I’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 name

      Users:
      // [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

    • #1735
      deanodley
      Participant

      Hi 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 | Teams

      However, 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

    • #1751
      Luke Oatham
      Keymaster

      Hi 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?

    • #1765
      deanodley
      Participant

      Hi 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

Viewing 9 reply threads
  • You must be logged in to reply to this topic.