Content Profile Create User allows one to create users from a directory of Content Profiles that are not yet associated with users. The use case that spawned it is described below:
The module was written for a church that kept a directory of members but had email addresses for only a small portion thereof. Using node import, it was possible to load each member as a Content Profile owned by User 1, but there was no acceptable way to create user accounts for those members that didn't have email addresses.
This module adds the ability to create users from Content Profiles one profile at a time by modifying the node edit form, multiple profiles at a time by defining a node operation, or all at once by providing an admin page from which to trigger a function that attempts to create a user from every Content Profile owned by user 1.
To the best of my knowledge, there are no similar projects to which to compare this one.
| Comment | File | Size | Author |
|---|---|---|---|
| #20 | content_profile_create_user.patch | 52.17 KB | thedavidmeister |
Comments
Comment #1
ianwremmel commentedSandbox URL: http://drupal.org/sandbox/ianwremmel/1090396
Comment #2
attiks commentedLooks good, but please rename admin.inc to content_profile_create_user.admin.inc
Comment #3
ianwremmel commentedDone: the file has been renamed.
Comment #4
attiks commentednice job
Comment #5
ianwremmel commentedThanks. Is there anything else I need to do to get this promoted to a full project?
Comment #6
m.stentaThis looks good. Can I subscribe to this in support of project-ifying it?
Comment #7
attiks commentedyou have to wait till someone with enough permissions will approve this
Comment #8
ianwremmel commented@attiks Gotcha, thanks for the info. The instructions were a bit vague on that point.
@mstenta Thanks for the support. Glad to see I'm not the only one who has use for this module.
Comment #9
rfayIn hook_menu() (for bizarre reasons) you don't put title or description in t().
However, most other places you do - these are missing it.
I like how you clearly separated out private and api functions.
The misspelling of $message in the parameter means that this function can't even work, as far as I can tell. Has this module been tested?
Comment #10
ianwremmel commentedHi rfay, thanks for pointing out the use of t() and catching that misspelling. I've committed the fixes.
As to testing, the site for which I developed the module isn't live yet, so I've tested most of the module, but the mail component hasn't been tested nearly as well as the rest. Also, many of the error states may not have been fully tested. If you catch any other issues, let me know and I'll take care of them.
Comment #11
rfayYou'll probably want to use http://drupal.org/project/reroute_email for this kind of testing.
Comment #12
ianwremmel commentedThanks. The next few days are pretty busy, but I'll see about getting the mail functions tested this weekend.
Comment #13
ianwremmel commentedSo "busy" was an understatement, but I've finally tested the module's mail functions and they all appear to work correctly now. (Hopefully) the module is ready for prime time.
rfay: http://drupal.org/project/reroute_email definitely helped a lot, thanks for the tip.
Comment #14
thedavidmeister commentedsubscribing, i have a very similar use case.
hope this becomes a full project soon :)
Comment #15
ianwremmel commentedhi thedavidmeister, thanks for the support. Have you tried it out yet or are you waiting for full project status? I welcome any feedback you have.
Comment #16
thedavidmeister commentedone of my developers is trialling it at the moment. Preliminary reports is that he struggled to find the per-user functionality, but found the bulk stuff ok.
Our use case specifically revolves around taking individual existing records and turning them into users with that record as a content profile, from the node view; bulk operations aren't useful to us.
To give you some additional context, we're setting this up for a school, and while we collect data for every potential student, only those that are successfully enrolled are turned into a full user.
We still are trialling the project on a dev server for our dev server :P
once we have something that works for us, we'll try to roll it into a patch and send it back your way. Hopefully you find some of it useful :)
Comment #17
ianwremmel commentedBy per-user functionality, do you mean the Create User button on the Content Profile node edit form? That button will only appear if the content type is marked as a content profile. Also, for the time being, Content Profile Create User only works if there is a single content type specified as a Content Profile. Hopefully that helps, and if it doesn't, can you provide more details on the difficulties?
Comment #18
sixteen penny commentedI am working on a project that this would come in very handy. How would I go about getting a dev copy of the module to test out?
Thanks!
Comment #19
ianwremmel commentedHi sixteen penny, thanks for the interest. You can get a development copy by visiting the sandbox URL in the first comment. From there, you should see the instructions for cloning the git repository.
Comment #20
thedavidmeister commentedi'm not sure how useful this patch is, we ended up hacking it up a lot, and it definitely doesn't follow Drupal's formatting standards any more, but i said i'd post it so here it is :)
thanks a lot for the base that we could work on!
we had to drop the form into its own tab, so it needed to work in a block, not just on the node edit form.
also, we needed the functionality of creating a single user from a content profile node to work on a node that was created by a priviledged user, not just an anonymous user, which was an issue because Content Profile assigns a profile to a user based only on the authoring info, so we ended up creating a rule (using the Rules module) that set the "authored by" info on any node saved by users of a particular role to anonymous.
the obvious caveat to doing this with a simple rule like that is that users with this new role can never have a profile, but that's fine for our use case.
Comment #21
rfaytest commentedPatches like #20 are a lot more useful in the module's issue queue.
Comment #22
thedavidmeister commentedwhat would you call the issue? we changed the wording of notifications, the way the form was displayed, some of the logic for creation of users.
would i just say "general changes" and put the patch there?
Comment #23
rfayNormally one would split the changes into logical chunks and file and issue for each one with a good title and a good description. Then the maintainer can work with you on what to do.
If you filed an issue in one of my queues entitled "general changes" I would just mark it "won't fix" and ignore it unless there were a great explanation.
Comment #24
thedavidmeister commentedah, i c. i actually didn't realize that the sandbox pages had their own issue queue too, i thought it was just for full projects.
unfortunately i probably won't get the chance to reroll that patch into smaller ones, so it will probably disappear into the abyss :(
but i'll take your suggestions on board for the future, thanks!
Comment #25
ianwremmel commentedHi thedavidmeister, I haven't had a chance to look too closely at your patch yet, but from your comments, it sounds like you touched on several issues I had thought of but decided were beyond scope at this time or complicated enough that I wanted to wait to see if others had such issues. It sounds like your additional requirements were allowing users other than user 1 to create userless profiles and creating users from userless profiles using a form on a block. Have I missed any other high level items that the patch does?
What was your use case for putting the form in a block?
Oh, any idea how to get emailed when updates are posted here? I've looked several times and haven't been able to find a way.
Thanks for the feedback and the patch,
-Ian
Comment #26
thedavidmeister commentedwe put the form in a block because we wanted to display it on it's own tab on the node page, but suspected that those requirements might change so wanted to keep the form "mobile" in case we had to move it again :P
not something i would expect you to include in the contrib module.
the use case you might be interested in for this project is that we have 2 roles, "student" and "student admin".
students all apply to the organization offline, and the student admin record their contact details/history as nodes and then some % of those students are successfully enrolled.
we use your module to provide newly enrolled students with a login into the system at the same time as attaching their admin record as a content profile to their account.
the first problem we addressed was allowing users other than uid 1 to use the module.
the second problem that we encountered was that when a student admin creates a content profile node, the content profile module assumed that the student admin was making a profile for themselves, not somebody else, so we used Rules to set the authoring information on the "student profile" content type to anonymous upon saving if the author had the student admin role.
lastly, we changed the wording of some of the warning messages to make them more descriptive for our use case.
Comment #27
ianwremmel commentedThanks for the explanation, that definitely helps. If all goes well at work today, I'll take a crack at adding an optional dependency on rules (e.g. It'll install without rules but rules will add extra features like the ones you needed). I'll admit, I was a bit concerned about how to allow other users to create content profiles. Does your solution deal with the fact that only one content profile can be created per user or is it simply mitigated by assigning it to anonymous?
Regarding your change to the default messages, you may want to take a look at the features module. I haven't used it much yet, but if it works they way I think it does, you could have changed the default message from the admin page and exported it as a feature to use on other sites. Not that big a deal given the other changes you made, but for other projects, it would give you a way to customize settings and move them to other sites without altering third-party code.
Thanks again for the feedback.
Comment #28
thedavidmeister commentedyeah man, we use features a lot in-house, if you haven't used it much, i highly recommend that you get stuck into it! (and look into Aegir, or at least Drush Make to really help leverage it).
i guess the developer who was actually tweaking this module for me didn't realize that what you'd set up was available to modify in an admin screen and exposed to features, or he just figured it would be easier to modify the strings while he was already editing other things in the PHP files.
the Rules thing was a "quick fix" as it is more of a work-around than an intended new "feature" (lower case :P) of the module itself.
if you were going to set Rules as an "optional dependency" it might be better to release a Feature (capitalized) alongside this project that demonstrates the work around as a "recipe".
also:
* we only need 1 content profile node per created user, we have a second type of profile node for info we collect after the student has been enrolled. Pretty sure an error is thrown if you try to create a user that already exists from a new proto-profile node.
* our solution means that the user role that is creating users can't really have a profile of that type set to their own account. This is fine for our specific "admin/student" use case, as admins will never need a student record but this system probably won't be flexible enough for many other use cases (which is why this might be better bundled as a Feature)
Comment #29
ianwremmel commentedSo, as usual, it took me way longer than expected to get to this, but here are my changes. They're not tested at the moment, so they're sitting in the dev branch for the time being. I'll try to get them tested in the next few days and merged into master.
1. I added a permission so that access control can be done from the permissions page rather than hardcoding to a role.
2. Instead of creating users from profiles owned by the Admin user (user 1) users may now only be created from Anonymous (user 0) profiles (When I first wrote the module, I was unaware of Anonymous content). I'm pretty sure this removes the need for the Rule you put in place.
3. I added a block that acts mostly in the same way as the one in the patch, but without the user name and password fields which seem beyond the scope of the module; if needed, they can be added via hook_form_alter.
Changes 1 and 2 should make it possible for your student admins to create users from profiles even if they themselves have profiles and change 3 should allow them to do so without need access to the node edit form or the admin pages (I hope).
Definitely planning on getting more into Features. I'm just about ready to move the site that I wrote this module for off of the staging server and onto the web and I'm planning on using features to get most of it there.
Oh, did you use git to make the patch? It looks like the changed to your git repo itself were also included, so I didn't apply it to my code as I thought it might hose my own repo.
Hopefully I've worked in something at least resembling your cases. If you've got any more ideas/requests, please let me know!
Comment #30
thedavidmeister commentedstill pretty new to making patches actually, there's definitely a chance that i did it wrong.
i hope this gets turned into a full project sometime soon!
Comment #31
ianwremmel commentedThe latest changes have been tested and merge into master.
Comment #32
klausi* info file has wrong line endings('\r'), should be '\n' unis line endings
* content_profile_create_user_block() has no correct doc block
* "@param $nids The nids of the nodes for which to create users" the description of the parameter needs to be on a new line, see http://drupal.org/node/1354#functions . Also at other places.
* module file, line 286: why is there a ';' ?
* _default_subject(): all functions of your module need to be properly prefixed with the module name to avoid name clashes with other modules
Comment #33
ianwremmel commentedHi klausi, thanks for the review. I believe I've fixed everything you mentioned Regarding "why is there a ';'?": I have no idea, it's gone now.
Comment #34
klausiGreat, some minor things:
* README.txt is missing
* create a release branch, e.g. 6.x-1.x and work from there, see http://drupal.org/node/1015226
Now before I mark your application as RTBC, would you be so kind and do a review of one of the other project applications as well? We have currently quite a backlog and need every help we can get. Just pick one from this list and notify me here if you have done so: http://drupal.org/project/issues/projectapplications?status=8
Comment #35
ianwremmel commentedHi Klausi,
I've taken care of README.txt (let me know if it's adequate) and created a 6.x-1.x branch. I've also reviewed Multiple User and Background SMTP Authentication Support (http://drupal.org/node/1299296)
Comment #36
klausiThank you
Comment #37
gregglesThanks for your contribution, ianwremmel! Welcome to the community of project contributors on drupal.org.
I've granted you the git vetted user role which will let you promote this to a full project and also create new projects as either sandbox or "full" projects depending on which you feel is best.
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider continuing to review other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Comment #38
gregglesComment #39
ianwremmel commentedHi Greggles, thanks! I will definitely start getting more involved in the review process.