I am trying to use this with a content type in which I want the author and a node reference field to be unique (in combination) for all content of that type. In other words, I need to force each user to create only one node for each possible reference node.
Functionality is correct when creating new nodes. The error is occurring when editing those nodes after they've been saved. When trying to save the node for the second time, Unique Field gives the error that fields are supposed to be a unique combination, then references ALL other content of that type for which I'm author as matches.
I am using the Node Reference from URL widget to set the value of the node reference field. However, I disabled that and fell back to the standard autocomplete widget and still had the same problem.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | unique_field-field_get_items-1163924-2.patch | 1.65 KB | derhasi |
Comments
Comment #1
arithmetric commentedI can't reproduce this issue. With the latest release, I'm able to configure a content type to require unique values for the combination of the author and a node reference field.
Could you test again with the latest code? If it's still not working, could you post screenshots of the Unique Field configuration for the content type and of the error message you receive when submitting unique content?
Comment #2
derhasi commentedThis is a major bug, when the module is used on a multilingual page (or a page where locale is activated). So it can be that the node language is for example 'de' (for german), but the fields are generally not stored language aware (so have the language value 'und').
This can easily be fixed by using the field api functions for that: field_get_items().
The attached patch solves this that way ;)
Comment #3
derhasi commentedI applied the patch to the current dev.
Comment #4
arithmetric commentedThanks for the patch. Committed: http://drupalcode.org/project/unique_field.git/commit/a38b934
Comment #6
justmagicmaria commentedHaving the same issue but there is no -dev release available for this project.
Comment #7
derhasi commentedJustMagicMaria, rc1 should contain the fix allready.
Comment #8
justmagicmaria commentedHmm... sorry for missing that this was closed before rc1 was created, but I am still experiencing this issue with rc1.