Export users problem

Hi – We are using the addon mostly successfully but have encountered a problem. When we open the exported file in Excel, the groups a user is in are in a single column. Our users will be in three groups. We can parse that column and split the data into three separate columns with no problems, however for some of the groups, the order of the group names in this column is different, so when we parse it out some of the groups are mixed up and we have to manually copy and paste data back into the correct columns.

Can you advise us on how we can have the groups consistently in the same order in the ‘Groups’ column?

Thanks for your help.

Barry

6 Responses to Export users problem

  1. bmc@bmcdesign.com February 22, 2019 at 10:08 am #

    Hi Denitsa,

    After some digging around I found how this is happening. I have a number of variable products which add people to group combinations and in some instances, the order of these groups was different. So I went into those products and corrected the order of the groups. This is term based and a new term starts on Monday so in future they all should be fine.

    Thanks for your help.

    Barry

    • Denitsa February 22, 2019 at 1:55 pm #

      Hey Barry,
      That’s great and much much better than having to edit the plugin’s core files, I’m glad you managed to find a workaround!
      Have a great one!
      Cheers,
      Denitsa

  2. bmc@bmcdesign.com February 22, 2019 at 8:56 am #

    Hi Denitsa,

    Thanks for the instructions. I will try that today and let you know how it works.

    thanks,

    Barry

  3. bmc@bmcdesign.com February 21, 2019 at 6:02 pm #

    Hi Denitsa,
    Thanks for the reply. Sounds like the sort() function is just what I need, but I have no idea how to include it…

    Could you advise please?

    Thanks,

    Barry

    • Denitsa February 21, 2019 at 8:27 pm #

      Hi there Barry,
      The quickest (and dirtiest) solution I can suggest in your case then is simply to add the line in your plugin file. Keep in mind that this is extremely hacky and would require you to edit one of the plugin’s core files and add the line after every plugin update, so it’s far from ideal and is generally considered very bad practice. I’m only suggesting that because it is a fairly simple change.
      So, what you need to do is open the file /wp-content/plugins/groups-import-export/lib/core/class-groups-user-export.php, search for the line that says
      $groups = implode( ',', $groups );
      and just before it paste the following:
      // Custom code change - must be added on every plugin update!
      // Sort the groups alphabetically before writing to the file.
      sort ($groups);

      Let me know how it goes!
      Cheers,
      Denitsa

  4. Denitsa February 21, 2019 at 5:34 pm #

    Hello Barry,

    The Groups are exported in the order they appear on the Users > All Users page under the Groups column, i.e. the order in which each group was joined by the user.
    If arranging the groups alphabetically works for you, using the sort() function on the array of groups before writing them to the file might be all you need to do.

    Cheers,
    Denitsa

We use cookies to optimize your experience on our site and assume you're OK with that if you stay.
OK, hide this message.

Affiliates · Contact · Jobs · Terms & Conditions · Privacy Policy · Documentation · Downloads · Useful Plugins · My Account

Share