Download & Extend

Make Conditional Fields compatible with Content Profile module (working patch available)

Project:Conditional Fields
Version:6.x-2.0
Component:Compatibility w/ other modules
Category:bug report
Priority:major
Assigned:Unassigned
Status:reviewed & tested by the community
Issue tags:conditional fields, content profile, module update

Issue Summary

Conditional field works perfectly when you use nodes.

But when the node is of type user profile that is created with the Content Profile module, the registration does not validate fields.

Comments

#1

Title:Conditional fields not validation in profile content type» Compatibility with Content Profile module
Version:6.x-1.0-beta2» 6.x-2.x-dev
Category:bug report» feature request

Please hold on while #648934: Plugin system for compatibility with non-core CCK modules is developed.

#2

subscribing

#3

Version:6.x-2.x-dev» 6.x-2.0-beta1

For me conditional fields on user profile nodes do work with 6.x-2.0-beta1, but only on the node/[NID]/edit pages, not when adding a new user with the user profile fields embedded into the user/user/create page.

Is there any way to get it working also on the user/user/create pages? Thanks!

#4

Version:6.x-2.0-beta1» 6.x-2.0-beta2

Conditional fields still do not work on user/user/create pages with 6.x-2.0-beta2. Any chance to get this working until the final 2.0 release?

Thanks.

#5

Status:active» needs review

That patch makes it work on user/registration and user/create, but it doesn't check that conditional fields is actually required.

AttachmentSize
conditional_fields_cck_profile_register.patch 485 bytes

#6

Status:needs review» reviewed & tested by the community

Yeah, great, can confirm that after applying this patch Conditional fields work on user/user/create :-) Thank you!

Also I have no problems with required conditional fields.

I think the patch should get committed.

#7

Status:reviewed & tested by the community» needs review

there was still a little issue, got sorted out by explicitly casting to (array). It should be good now.

AttachmentSize
conditional_fields_cck_profile_register-2.patch 1.16 KB

#8

Status:needs review» needs work

I have reverted your original patch from #5 and applied the updated one from #7 and did some tests with more than one required conditional fields. The current patch worked as well as the original one, requiring the first required conditional field, but ignoring the second one on node save. On the first node edit, the second required conditional field was in fact required so you had to select something while editing, but didn't need to do so on creating the node (user).

Thanks anyway for your efforts!

#9

Subscribing...

#10

The patch in #7 worked great for me. Thanks!

#11

Category:feature request» bug report
Assigned to:eloiv» Anonymous
Status:needs work» needs review

the patch in #7 works if you only have 1 content profile on the registration page or if the one that has conditional fields is the first one (as far as i can tell)
i had 2 content profile types and the second one had the conditional fields, problem is that the after build function checks only on the first one.. this is fixed in my patch
i also made a small fix to the form_alter hook to use the same function the module already used on nodes (same functionality though, at least right now.. that function just sets the after build hook)

please review this with only 1 content type and let me know how it works then.. also, i dont have any required fields that are conditional, so i didnt test that

AttachmentSize
conditional_fields-619290.patch 2.08 KB

#12

Thumbs up from me! I've also confirmed that it works for required fields that are conditional.

#13

I can confirm that #11 works with required fields, and one or two content profile types.

#14

Then the status could be changed to RTBTC?

#15

Status:needs review» reviewed & tested by the community

#16

Status:reviewed & tested by the community» needs work

Whoops... I thought this was fixed, but there's still a problem (though it's certainly a step in the right direction): If two or more content profiles have conditional fields, only the first set will work, because conditional_fields_add_js() only works the first time it's called (line 810 after applying abaddon's patch).

/**
* Adds javascript to the node editing form
*/
function conditional_fields_add_js($settings) {
  // Avoid adding js twice when the node form has failed validation
  static $js;
  if (!$js) {
    drupal_add_js(array('ConditionalFields' => $settings), 'setting');
    drupal_add_js(drupal_get_path('module', 'conditional_fields') . '/conditional_fields.js');
    $js = TRUE;
  }
}

#17

Status:needs work» needs review

I've generated a new patch that should fix this final problem. Please give some feedback!

AttachmentSize
conditional_fields.patch 5.66 KB

#18

Ooops... I made a small typo and I accidentally put one of my other fixes into that last patch. Try this one instead.

AttachmentSize
conditional_fields.patch 5.06 KB

#19

Status:needs review» reviewed & tested by the community

Nice job! #18 works like a charm! =)

#20

Not sure why but patch #18 did not work for me but it didn't. I also tried most of the other patches too with no success. I'm only testing on the registration page so I'm not sure if other pages are working or not.

#21

subscribing, was on the duplicate bug and want to follow this thread too.

#22

deggertsen... Could you tell us a bit more about your situation? Is it possible to replicate your problem on a fresh Drupal 6 install? If so, I'll try to get it figured out for you.

#23

I'll try to just reinstall when I get a chance and see if it will work then and let you know. Hopefully today...

#24

Just uninstalled and reinstalled with patch #18 and everything works wonderfully! Sorry to cause any doubt...

Thanks!

#25

It's working like a charm for me too. Using drupal 6.20, content profile 1.0 and the patched (#18) version of conditional fields 2.0-beta2. I'm wondering that it is not in dev already?

Anyway, jjwhitney, thanks a lot!

#26

Oh, one thing. If you're using drupal_get_form('user_register') in your template or in a preprocess function you have to make sure the additional JS is loaded. Then conditional field is working on those forms too.

<?php
function my_module_or_theme_preprocess_page(&$vars) {
  if (
$vars['is_front']) {
   
//adding the user_login form
   
$vars['form_user_login'] = drupal_get_form('user_login');
   
//adding the user_register form
   
$vars['form_user_register'] = drupal_get_form('user_register');
   
// make sure additional javascript that was added in hook_form_alter is also loaded
   
$vars['scripts'] = drupal_get_js();
  }
}
?>

#27

After apply #24 then Patch #18 works fine! RTBC to 6.x-beta3?

#28

Patch in #18 works very well for me, in user registration page.

Can this be committed ?

Thank you very much

#29

I would be so grateful if you would teach me how to apply this patch; where to insert. Thanks

#30

http://www.google.com/search?q=drupal+apply+patch
theres some page on drupal.org but i cant find it, i found something GIT specific and its not what you want

continue in the support forum, this isnt the proper place to ask

#31

Thanks abaddon, I found how to apply a patch on the the conditional_fields module, but the issue now is that the patch is not being implemented successfuly. I am getting an error when I am applying the patch

#32

the patch in #18 applies cleanly to conditional_fields-6.x-2.0-beta2 but with -p1 instead of -p0, heres an edited patch that should work with the default -p0 (does windows have -p? sorry i only have linux)
and i didnt test the patch, just edited for -p0

make sure you apply it to the proper version of the module, and not an older one

AttachmentSize
conditional_fields_6.patch 4.98 KB

#33

Nice work. I was using content profile and needed conditional fields to work on registration form (frontend). It was okay in edit form but your patch help to make it work on on both so thank you.

using this patch with:
conditional fields 6.x-2.0-beta2
content profile 6.x-1.0

#34

Hello,

I have applied the patch below (32), that is what I get :

conditional_fields_6_0.patch:21: trailing whitespace.

Checking patch conditional_fields.module...
Applied patch conditional_fields.module cleanly.
warning: 1 line adds whitespace errors.

But fields are staying disabled when adding a new user. Even if when I activate the controller field.
Any idea ?

Rectif : Not working when controlling a "Group", but it is working when controlling directly a field.

#35

I applied the patch in #32 cleanly and works!!

#36

No problems detected after patching from #32 :)

#37

So could this please get committed?

#38

for me it also doesn't work. i have two content profiles for 2 different registration procedures. for choosing the right profile in login I use autoassign role

#39

Version:6.x-2.0-beta2» 6.x-2.0
Priority:normal» major

Unfortunately, the final 6.x-2.0 has been released now without including this patch :-( After trying it out I realised that it does NOT work with content profile fields, and this thread's patches no longer can be applied either. So I had to revert back to 2.0-beta2 with the patch #18, which is working fine.

@abaddon: Patch #18 is alright - since Drupal's revision control is Git based patches must be in -p1 format (and no longer in -p0).

#40

Status:reviewed & tested by the community» patch (to be ported)

Since patch #18 cannot be applied to 6.x-2.0, can anybody please port it to work again with the latest official release?

#41

Here's the new patch.

AttachmentSize
content-profile-compatibility-619290-41.patch 4.93 KB

#42

Status:patch (to be ported)» reviewed & tested by the community

Excellent, patch #41 works perfectly with 2.0. Thank you. Hoping that it finds the way to the official code one day.

#43

Title:Compatibility with Content Profile module» Make Conditional Fields compatible with Content Profile module (working patch available)

#44

Issue tags:+module update

As 1.1 is not supported any more, any website may fail after security update from 1.1 to 2.0.

Patch #41 works fine, thank you!

#45

Not sure about which security update you are speaking.

Hope to see this patch finally applied in 2.1.

#46

Subscribing

#47

works like a charm for 6.x-2.0!

#48

Yes, but still needs to be committed!

#49

Any chance to get this patch committed? It is urgently needed.