I would like to have a field in a node which will have 3 let's say values. I want the user to be able to edit this field and set his/her personal value (one of the three available). Now the node will have a personalized field value that will appear only to that user. Therefore, this field will have a different value depended on the user.

Comments

seancorrales’s picture

I'd try approaching this differently. Instead of having one node that has 20 different values for 20 different users, you'll probably need a content type that ties a given user to a given node.

I'd look at creating a content type that had a node reference and a user reference. Node reference would be auto-populated by the current NID, user reference would be auto-populated to be the current user, and then you could have any additional fields for them to fill out.

zandros’s picture

So if I understood correctly, A new node will have to be created every time associated with the original node. Or many nodes will need to be created (depends on the number of users) associated with the original node?

seancorrales’s picture

Many nodes dependent on the number of users who filled out the custom field.

zandros’s picture

Wouldn't that be bad for the database since multiple new nodes will be created for each user?

seancorrales’s picture

Heavy? Not so much. Having several nodes does not equal heavy load. For example, let's say you wanted to display this custom field when they visited the node. Instead of loading one node, you'd be loading two. If you used views to display the field, you could retrieve just the field making the load even lighter. This isn't much more load unless you're having tons of visitors. In that case, the extra server load/mysql calls could be an issue.

Depending on how you're structuring the site, this could cause some bottlenecks. If you wanted something lighter, best solution would be to create a custom module to implement this in a lighter way. It wouldn't be too difficult, for example, to create a module that could add the field you needed to the content type and allow a per user value as you originally wanted. You'd just need to alter the form and then save the value to a database table.

zandros’s picture

I may try the second approach. The only similar module that does that is the flag module. But it has only the true or false value. No multiple values are available (specially in D7).

seancorrales’s picture

Bit of advice - unless CCK fields have gotten easier to work with in D7, I'd recommend adding the field to the nodes via your module. I wouldn't create a CCK field in the Drupal UI and then attempt to work with it with your module code.

zandros’s picture

Yes, it should be hard coded. I think it will save me some time in implementation too. It's weird that there is no module for this.

fnapo’s picture

seancorrales, how would you do that?
Using Views? Rules?
I'd like to create a view where there are some node titles
then I want the user click on the title and be prompted for the "create node" where he can fill extra fields
the node created should be related to the node showed on the original view
so, hos would you do that? :)

gregaltuna’s picture

"Therefore, this field will have a different value depended on the user."

Different value based on specific user information or just based on the choice made by the user? Are you wanting the new field to display according to the user's choice? Sounds like Conditional Fields...

http://drupal.org/project/conditional_fields

Let me explain something to you. Um, I am not "Mr. Altuna". You're Mr. Altuna. I'm the Greg. So that's what you call me. You know, that or, uh, His Gregness, or uh, Greggie, or El Gregerino if you're not into the whole brevity thing.

zandros’s picture

I want this field to show the value that the user has selected. For each different user will show the value that that user has selected. (so for each user it may be a different value)

For example we have an item such as a "show": And the user can select from the field the following values: Have seen it, want to see it, I don't want to see it.