Score:0

How do I import user roles with feeds?

cn flag

I created a CSV file with a column "Roles" and values like role_a, role_b, where role_a is the machine name of the role.

However, when I try to import the role in my feed, I get an error that role_a and role_b do not exist-- but they definitely do exist on my site. How can I import roles?

Score:0
cn flag

By default, the Feeds module can only handle a single input value. To input multiple values (such as multiple roles), you need to modify the data before Feeds processes it.

You can do this with the Feeds Tamper module.

  1. Install the Feeds Tamper module.
  2. Go to the Tamper tab of your feed type admin screen (/admin/structure/feeds/manage/MY_FEED_MACHINE_NAME/tamper.
  3. For the Roles field, click Add Plugin and add the Explode plugin with the default settings.
  4. Next, click Add Plugin again and add the Characters to trim plugin with the default settings.

If you don't complete step 4, then when Feeds Tamper explodes the string into multiple values, your second value will be role_b (with a space in front), which will cause assignment of that role to fail.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.