Closed (fixed)
Project:
Node Profile
Version:
master
Component:
User interface
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
16 Oct 2006 at 09:09 UTC
Updated:
17 Dec 2006 at 17:30 UTC
Jump to comment: Most recent file
Comments
Comment #1
fagono, currently not. However any contributions are welcome!
Comment #2
sym commentedOk, I've started writing some code that will work on the registration form for CCK nodes.
It's in the nodeprofile module at the moment but it's just using the hook_form_alter, so it could either be a patch or its own module.
What would you like more? As I say, at the moment it's only for CCK nodes.
Comment #3
fagocool!
I would prefer a separate module, because the nodeprofile module works with every node type and I don't want to loose this abstraction.
A cool way to implement this would be to allow or force users to fill out pageroutes at the registration (or better directly after the registration).
Comment #4
sym commentedChanged to "patch (code needs work)" even though it's not a patch - I hope that's right!
Ok, so I've got *something* working. Notes:
1) I wasn't sure how the profile type worked, so at the moment it only works if you only have 1 content type defined as a node.
2) I have had to build the form field by field, so that in future I can add (maybe in the form of a table) some way of selecting what fields go on the registration form. I don't need this at the moment though.
3) I want to be able to use any content type for this, not just CCK types. Does anyone have any idea how I can get per-field form item permissions for any node add form in 4.7?
Leading on from that, the tasks are:
1) make it work with more than 1 profile, and put each one in a fieldset.
2) Add a table and a checkbox on the field settings page that will set if the field is on the register page.
3) Make it work with any content type.
4) Do something with roles, so that we can change the profile depending on the role the user is registering for (I have a module called rolesignup that allows user to do this, but it's not in CVS yet).
This module needs the nodeprofile module to be set up with a CCK content type.
:)
Comment #5
sym commentedSorry, one more note about:
It's a hack that I don't really like. It would be nice if CCK types would keep the value the same as the module name, unless I've missed a far better way of doing what I'm doing....
Comment #6
fagoif you want to independend of the CCK, it would be difficult to have per-field granularity. however, you could go for a new boolean formapi parameter 'registration', then your module could get the node form per node_form() and unset all form fields, that don't have the registration value set. still not really beautiful and you will loose all changes that are done by hook_form_alter() on node forms.
So i would suggest to provide this feature by creating
So most use-cases should be possible and your module is a fine start for the first method.
To detect, which node types are used as nodeprofile you can use this: (untested)
However it would be sane to check all types that are in relation with any profiletype (nodefamily-content_type-relations)! Or just check every cck-content-type.. ;)
As you mentioned, a way to check the fields, that should be filled by registration would be fine. E.g. make a checkbox on every CCK field edit page (you can have a look at the fieldgroup module, it also injects an extra field there).
Your form['type'] field could be of type 'value' instead of hidden.
Your rolesignup module sounds really interesting, would be cool to have it in CVS. Then I would suggest to do access checking, if the user is allowed to create a node of the used node-type. Have a look at node_access('create', $node).
Comment #7
sym commentedOk, I've more or less rewritten the whole module.
Now every content type works in theory (I'm using node_form_array()). I wanted to get uploads working from modules like imagefield, but I don't need them right away so I'll leave them out.
As you can see, I'm unsetting the preview, submit and title fields. I can extend it to query a database table for per-field permissions. I've also called each modules form_alter hook myself, so that works on the forms now :)
It's getting there - now I just need to re-write role signup (now in CVS and a project) so it works better, and I can make them work together, allowing for per-role profile pages on the register page :) I will add this to CVS soon as well.
Comment #8
fagocool! I'm really looking forward on your solution!
a short note to your actual code:
You are building the form array out of possible multiple node-forms. Shouldn't you save multiple nodes then?
Comment #9
sym commentedI am saving all the node forms;
The node forms are placed in to fieldsets that are trees, so I check if the field is an array (and therefore a fieldset) and then save the whole tree (IE the node form) minus the submit, preview and title.
Thats why I add the title in again just before the node_submit call.
I would welcome you testing it with more than 1 profile node - you should see a node made for every profile node, even if there is no data in that fieldset.
Comment #10
fagoah yeah, I overlooked the loop. great!
Comment #11
liorkesos commentedHello guys,
Working on a registration form that will create a profilenode as well.
My profilenode cck had fieldgroups enabled and weighted fields within and they somehow get stripped out in the registration form.
I'm pretty much of a newbie to drupal hacking but I'll give it a go...
Will update within the next thread if I learn anything interesting.
Lior
Comment #12
guanyu commentedHi Sym, where is the is_nodeprofile()? I got the following error.
Fatal error: Call to undefined function is_nodeprofile() in /var/www/drupal/modules/registerprofile.module on line 10
Comment #13
sym commentedHave you installed the nodeprofile module? Unless it's changed, then you need to install it and get it full working before using this module.
Comment #14
burningdog commentedThanks Sym, your registration.module works perfectly! I've installed it on Drupal 4.7.4 along with the following modules: CCK, nodeprofile, node_privacy_byrole, nodefamily and usernode. This lets me in particular use a multiple value select list (via CCK) as one of my user profile fields (which profile.module doesn't allow) and then presents my entire CCK node to the user to fill out during registration - brilliant - and then displays the results when the user clicks on "my account" (via a user_profile.tpl.php) :)
Comment #15
Bèr Kessels commentedThis is a slightly modified version. I added an extra form alter with another form_id. Node forms come with several IDs. with this addition e.g. field-group for CCK fieldsets work too.
Bèr
Comment #16
sym commentedThat's great, thanks!
Comment #17
sym commentedI've created a project for this module now.
Comment #18
fagogreat work, thanks a lot!
Comment #19
(not verified) commented