This is a continuation of a thread started at http://drupal.org/project/comments/add/56891.

I'm working on a module to allow the use of cck nodes in the user profile. I wanted this capability partly because I need to track contact info for groups that have both user and non-user members. I want to show info in views, link them to events, etc, regardless of whether or not they have a user record. I am using cck with userreference and nodereference to link everything (contact info, events, team info, etc.) together and it is working quite well as a relationship management system. For those contacts that are also users, I also needed some way to integrate the info into the users table beyond just linking to the user record, hence this module. It still needs lots of work, but basically I just tried to emulate the things that the profile module provides, only doing it with cck. It works as follows:

1) It's a separate module that can be enabled if you want this functionality. I originally thought about adding it into the userreference field, but I think that is overkill for a simple field. This way you only enable and use it if you really need this ability.

2) Once you have one or more content types set up that have userreference fields, you can go to the module settings page to identify which one(s) should be displayed as user profiles.

3) Nodes of the selected content types will then be displayed in the view and edit pages of the user record. Each content type is grouped in its own fieldset or under its own tab.

4) The selected nodes also are displayed on the user registration page so that the user can fill them out at registration.

5) I have tried to set this up to allow many-to-many relationships between users and nodes, which would allow me to link several different content types to a user record to track various kinds of data, and also allows me to link more than one contact record to a user for instances where I have family members that share an email address (and therefore share a user account).

At this point, everything is displayed where it should be and some fields update correctly (simple ones, like text fields that don't have multiple values). Multiple value fields don't update correctly yet. The user registration process still needs work, too since that needs different processing.

I originally thought about adding in field-specific access control, but as moshe pointed out, it probably makes more sense to wait and let cck take care of that.

Anyway, it's a start for anyone else who is interested in this sort of feature. If there is interest, I can keep you posted on my progress, and ideas/contributions are always welcome.

The module is in my sandbox at http://cvs.drupal.org/viewcvs/drupal/contributions/sandbox/karens/conten...

Comments

Patrick Nelson’s picture

Hi Karen,

I tried the module in your sandbox today with the latest CVS versions (Drupal and Views) and I receive an invalid foreach() when I enable the module and on every page thereafter.

Has something changed in Views that affects this module?

Regards

Patrick

yched’s picture

Yes, Merlin has committed quite e few changes for views a few hours ago.
They might require at least that you empty your cache, maybe rebuild your views ?

Apart from that, it seems that cck's "views integration" code is broken - views looks for fields in the wrong tables. Not sure about what is exactly going on, still investigating...

karens’s picture

I need to update it when merlin gets done, plus I've added a number of features on my local version that haven't made it to my sandbox yet. I am going to try to get to this tomorrow.

Patrick Nelson’s picture

Thanks guys, I'll wait quietly for the dust to settle!

Patrick Nelson’s picture

Thanks guys (and girls!), I'll wait quietly for the dust to settle.

yched’s picture

Forget what I was saying about views support being broken in CCK.
False impression, caused by... something completely different, whatever. (spent my afternoon on it, though...)

So everything seems OK between views and CCK.

There was, however, a lot of internal changes in views yesterday (and maybe some recent changes in CCK ?), that might require Karen's sandbox module to be updated - or not, I don't know about that :-)

Patrick Nelson’s picture

yched,

Sounds like you're having "one of those days"!

yched’s picture

does it ? :-)

merlinofchaos’s picture

*cough*. Sorry. The dust should be pretty well settled. I didn't think anything I changed would affect CCK tho, but it's hard to say for sure.

michelle’s picture

Wow, I stumbled on this by accident. I was just trying to decide how to deal with the same issue at my club website. I had been leaning towards just making everyone a website member regardless of whether or not they even use the web, but I'm going to hold off and see how this plays out. :)

Thanks,

Michelle

sym’s picture

I am about to start work on a module that would allow different roles to have different profile fields.

The point of this would be for a site that connects individuals and companies, so the individuals would have a standard set of fields (name, address etc) and the companies would have more fields like business name and address.

I would love to use CCK for this: just set up 2 different content types and assign it to roles.

I’ve not looked at this much, but are you interested in working together on it? How active is the project? Should I wait for it to finish and try to extent it?

Thanks,

Sym

Patrick Nelson’s picture

Sym,

I'm trying to do exactly the same thing myself so how about we collaborate?

Regards

Patrick

jonbob’s picture

I am very interested in this development progressing. I don't think it requires any modifications to the CCK core, though; I'd recommend starting a new project for the profiles-as-nodes module (whatever you call it) and then submit separate feature requests if CCK lacks some API you'd need.

I think that the only thing CCK brings to the table here is customization. You could implement this feature using a custom node type or even something like story.module if you didn't need the admin customization part. So let's keep this as loosely coupled as we can.

karens’s picture

I think it makes sense to start it as its own project and would be glad to do so. How do I do that?

I agree that cck is not likely to need any changes to make it work, at least in my work so far I have been able to do whatever I needed with the tools that are available. The one exception is that I need a small bit of control over the userreference module, just enough to make sure it doesn't do anything that breaks the ability to use a cck node in a user profile.

Once I figure out how to start a new project page, I can post what I have so far for others to get at and adapt.

karens’s picture

OK, I figured out how to start a new project. I'll get the process rolling and let everyone know once it looks like it is available. Look like it will take a couple days, at least, to get everything done, approved, and publically available. Then I'll check back and see who is interested in contributing to and/or maintaining it.

Bèr Kessels’s picture

Karen.

Please hold your guns for a sec. I told above that I have a working profiles-as-nodes running. It is in test ATM, and I do not yet have time to share it right now (it needs cleaning, and some polishing). But feel free to mail me: ber at webschuur dot com then I can fwd you a copy of the module in its current stat.

Bèr

sym’s picture

I don't want to pull this too far off topic, but has anyone thought about using the ecommerce address module to handle profile addresses?

See http://drupal.org/node/63340 for more info.

Bèr Kessels’s picture

address (used to?) have states hardcoded. And that is a non option for The Rest Of The World [1]

Last time I looked address from ecommerce was long due an overhaul. With all due respect to the develpers that is! Somewhere, long ago, it scratched an itch, but it should have been updated long since. And yes, I am to blame for not doing that update just as much!

So no: what we need is real proper address and relation management. I beleive CCK is perfect for that.

[1] http://uncyclopedia.org/wiki/Rest_of_World

sym’s picture

Yes, you're right...and in some ways thats what I ment....

I should have said: could we start to use a standard address system that can be used anywhere? This should be part of the profile rather than ecommerce. Ecommerce could use the new standard address system.

I guess this is a side project, but I am interested in CCK being a part of it.

I think this is more than just a matter of ecommerce using CCK, because you would need a standard set of fields to make up an address etc.

Anyway, it's something to think about. I will try to do something with it once this module is in a better state.

karens’s picture

Ber,

I did not do anything about starting a project, I'll let you handle that.

Re addresses: why not use the location module? I think the combo of CCK and the location module is a great solution. I know the location module is not yet working for all international locations, but that is the direction it will be going.

Patrick Nelson’s picture

Please don't think I'm selfish, but the location module is of little use in the UK without the relevant data and that data is expensive over here. The PAF database which holds lat/long details against zip codes for the UK is licenced by the Royal Mail and is well out of the reach of most small businesses and us poor developers :(

Bèr Kessels’s picture

Status: Active » Closed (works as designed)

http://groups.drupal.org/profiles-as-nodes Please join that group, so we can work on this project.

t4him’s picture

Hi All, I was following this very interesting development. Actually I was tryint to see if anyone has been able to use cck to create a node with a drop down list of users e:mail addresses. ie user reference drop down box, field type users e:mail.

I have not used cck very much, so this may seem off base, but the 'add existing field' drop down list box in cck list only cck fields. Could this be done by 'exposing' existing fields from the profile module.

Thanks for letting me shout in on this great discussion. I will follow the links over to the 'Profile as Nodes'.

regards,

t4him
--*--
post back with soultions

notabenem’s picture

How does this module compare with this:
http://drupal.org/node/65387 ?
Is this a predecessor ? If not, what are (will be) the differences?