Profile CSV doesn't export Roles for profile

dragonfyre6 - January 24, 2008 - 03:07
Project:Profile CSV
Version:5.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:dragonfyre6
Status:needs review
Description

I'm using this to manage getting users into other apps (googledocs for example) to administrate and keep a hard copy of users, as well as to plan events off of. Unfortunately, one of the main things I need this for is roles.

I can choose to only export a single role, and that's fine. The problem is, I want it to export "this user has these roles" as a field.

After this is done, it would be much easier for me to code a custom bit to pull out the role expiration portion from the table Ubercart creates. I'm using temporary roles to manage group members, and they have to pay membership dues. Each of the roles is assigned to them only if they have purchased it, and I am tracking the roles via drupal. I'd like to track these elsewhere, thus the feature request.

#1

dragonfyre6 - January 24, 2008 - 06:28

Seems I fixed my own issue.

I've got the code here if you want it. It's from the current 5.x version I downloaded from the main page. Just run a diff if you need that.

Basically, it not only adds the ability to get the roles the user is in on the system, but also to get the dates those expire if you have ubercart installed. You can get these out as timestamps for easier import later (that's how they are stored, and the import is my next project) or as a prettified date/time representation like below. I copied and pasted an example of the output for all to see, and evaluate. It handles multiple roles, some with expirations and some without, quite well. You can also just turn off the expiration stuff, and just have a yes or no to each role.

"name","mail","Home City","Workplace","Full Member of TestSite","Lifetime Member of TestSite","Student Member of TestSite","temporary member"
"testuser","dragonfyre13@gmail.com","","west","January 22 2009 11:43 pm","no","no","yes"

P.S. some of the database stuff could be optimized a bit more, especially when accessing the uc_roles_expirations table in conjunction with the user_roles table. I'm sure there's some sort of left join I can do, but I'm tired, it's late, and this took me almost 2 hours to code and an hour to test already.

AttachmentSize
profile_csv.module.tar_.gz 3 KB

#2

dragonfyre6 - January 24, 2008 - 06:29
Assigned to:Anonymous» dragonfyre6
Status:active» needs review

Ah, forgot to update status. Sorry about that.

#3

ataylor99 - April 1, 2008 - 21:02

Thanks for this. Just wondering if you or anyone else has modified this patch or developed another solution since January 2008.

#4

dragonfyre6 - April 2, 2008 - 04:39

Nope. Is there something that needs to be added?

#5

new_B - January 7, 2009 - 15:29

Thanks for the patch dragonfyre6.

I've tried it & it's working for me. Is it working fine for anybody else? (I would like to include it on a production site.)

Will this patch be applied to an official release in the near future?

#6

transformative - February 5, 2009 - 18:09

Just in case it's of any use to anyone, I'd also created a patch to do something similar. My patch allows for the selection of user status, member since, last access, and roles.

Here it is:

AttachmentSize
profile_csv.patch 3.23 KB
 
 

Drupal is a registered trademark of Dries Buytaert.