Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi
I have a Registration form (using Component Profile) with a cck field called Zone (Province, City, etc) and using Hirarchical Select as widget.
All goes OK, the anonymous user select the city and submit the registration form. All fields are saved in the database except the Zone field.
I've tried to debug using _nodeapi and I see that for INSERT operation, the field is empty.
Any idea to solve the problem?
Note:
The field is configured with these options:
-Save term lineage
-Force the user to choose a term from a deepest level
Comments
Comment #1
jibort CreditAttribution: jibort commentedPlease, some idea?
Is there any person who had success with a registration form (with content profile) and a CCK field using Hierarchical Select in that registration form? Is this suported?
Thanks
Comment #2
rutiolmaI managed to resolve this issue for my specific problem.
In my opinion the problem is in the content_profile module. In the folder "modules" under content_profile, there's a "content_profile_registration.module" with a declared function named "content_profile_registration_user_register_submit".
When I print the $node content, I see that the content taxonomy (CT) field isn't formatted the right way to be saved. This CT array, needs to have one or more arrays of numeric values (like [0], [1], [2] etc) and inside each a array called [value] with the CT values.
for example in my case, the $node value outputs:
and the work around was putting the following snippet in content_profile_registration_user_register_submit function
Cause the lack of time, I cannot provide a patch neither a generic workaround (maybe in the future), but I hope it helps.
Comment #3
jibort CreditAttribution: jibort commentedalthough it is a very very specific solution, it really works! thanks!
Try to find out why these areas are badly formatted. More than Content Profile, do not you think that could be a problem specific to the Hierarchical Select module?
Thank you very much!
Comment #4
lcollet CreditAttribution: lcollet commentedHello,
I didn't set a patch but this following code should help to not set hard coded values.
This code snippet should be placed in the content_profile_registration_user_register_submit method just before the node submition.
It is working fine with single fields, I didn't tested with mutliple ones.
Hope this helps.
Comment #5
Wim LeersSo basically this is once again an epic Content Taxonomy fail. I'm so sick of Content Taxonomy. I won't spend any more minute in that code. I'll accept a patch, but I won't support it myself.
Comment #6
sifaan CreditAttribution: sifaan commentederr... sorry if this is a lame newbie question; but what are the alternatives to using Content Taxonomy if I want to use HS with CCK/Views?
Comment #7
Wim LeersThere are none. Content Taxonomy is just a fragile piece of shit that most of us try to avoid as much as possible. In D7, there is a Taxonomy field in core and this will no longer be an issue :)
Just use core's Taxonomy in D6.
Comment #8
ilsodas CreditAttribution: ilsodas commenteda
Comment #9
ilsodas CreditAttribution: ilsodas commentedComment #10
jvandyk CreditAttribution: jvandyk commentedComment #11
gabor_h CreditAttribution: gabor_h commentedHi,
Here is an improved version of #4. It seems to work with multiple fields, too.
The instructions, again:
The content_profile module contains the "modules" folder which contains the "content_profile_registration.module" file which contains the "content_profile_registration_user_register_submit" function . This code snippet should be placed in the content_profile_registration_user_register_submit method just before the "Create the node" and "node_submit($node)" lines.
Comment #12
samuelet CreditAttribution: samuelet commentedIt's working for me.
Should this issue be moved into the Content Taxonomy project?
Comment #13
Balbo CreditAttribution: Balbo commentedI got this warning on my test site:
# warning: Invalid argument supplied for foreach() in .../sites/all/modules/content_profile/modules/content_profile_registration.module on line 269.
Line 269 is the
foreach ($field_table['tids'] as $key => $value) {
.I'm not sure what the snippet is about and would appreciate any help. I think the error it's related to the other module I'm using which is http://drupal.org/project/hs_nodereference.
Comment #14
Balbo CreditAttribution: Balbo commentedOk. I did some changes in the code so you can use it if you are using Hierarchical Select and Hierarchical Select Node Reference with Content Taxonomy.
It's working for me, but please take a look at it and tell the community if you find it not to be correct or safe.
Comment #15
mandclu CreditAttribution: mandclu commented#11 worked for me (I'm not using Hierarchical Select Node Reference).
Comment #16
kenorb CreditAttribution: kenorb commented#944788: Values not saved when used in registration with Hierarchical Select
Comment #17
feuillet CreditAttribution: feuillet commented#11 works like a charm here. Thanks!
Comment #18
arski CreditAttribution: arski commentedwhy on earth was this post closed and the #944788: Values not saved when used in registration with Hierarchical Select kept open?? after all, it is this one that provides possible solutions! :O
Comment #19
arski CreditAttribution: arski commentedand btw +1 on the fix, looks good. How about you create a real patch so that we can at least try and get it committed?
Comment #20
Kcannick CreditAttribution: Kcannick commentedI'm having the same error "Invalid argument supplied for foreach() in .../modules/content_profile/modules/content_profile_registration.module on line 269" however I am not using the node reference field on profile type. Also tried adding the code snippet you posted below with same result.
Comment #21
capellicI am having the same issue as reported in #20. I am using the HS field on a profile which is also appearing on the registration form. I am not using it with node reference. There are two other Content Taxonomy fields on the form, but none of them are using HS.
In my case, a value is saved even with the error. But it's not a value from this field, rather it is a taxonomy value from the first content taxonomy field on the form. If the first value in the HS field is selected, it saves the first value of the first Content Taxonomy field on the form.
Comment #22
capellicI don't know why my situation is different, but I had to change the 'tids' loop to be this:
Comment #23
anjjriit CreditAttribution: anjjriit commented@ gabor_h #11
Thanks a ton !!!
You save my life, your instruction is very clear.
Keep working!!!
Comment #24
franzWith my current module versions, the 'tids' is not an array, at least for non-multiple fields, so I changed the snippet (and improved the query to be a little more on standards)
Comment #25
smakisog CreditAttribution: smakisog commented#24 Work for me. Thx!
Comment #26
wizonesolutionsIs this only for Content Taxonomy users? I use Content Profile and am hitting the same error. The form also seems to be arranged incorrectly from what HS expects. Is there a version of this fix when using the core taxonomy field in D6 and having selected the Content Profile content type as one of the types for which terms can be selected?
Comment #27
franzwizonesolutions, I believe the fixes posted are all related to Content Profile usage on registration. However, I'm unsure if they fix the core taxonomy fields. Maybe you could test or consider using Content Taxonomy on it (which is a great addition).
Comment #28
jordan8037310 CreditAttribution: jordan8037310 commentedHas anyone else had any more issues with this? Currently having the same issue but the patches are not fixing it.
In my case, this doesn't work when we have one of the hierarchical fields hidden. When both hierarchical menus show it saves fine.
Anyone have a solution for this?
Comment #29
jordan8037310 CreditAttribution: jordan8037310 commentedIn order to fix this issue I had to reset the $form['#uid'] in later executed functions.
I inserted the below code in order to "reset" the Form#uid where it was needed.
For my purposes this code was inserted into content_profile_useredit_user_edit_submit()...
Hope this helps others if they have more issues!
Comment #30
GoldTidying up the issue queue. The 6.x version is no longer supported. Only reopen this if it also applies to the 7.x.