Compatibility with CCK3 (multigroup)
Cristhian - November 2, 2009 - 19:56
| Project: | Content Profile |
| Version: | 6.x-1.0-beta4 |
| Component: | User registration module |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Description
As described in #541768: Call to undefined function _content_is_empty(), Content Profile's User registration module produces the error _content_is_empty() when using multigroup in a Content Profile Type, and I solved it replacing:
<?php
node_validate($node);
?>with
<?php
node_validate($node, $form);
?>content_profile_registration.module, line 207.

#1
subscribe...
I tried the patch – however not with the latest (and greatest) CCK3 branch.
Using it results in having no code errors anymore.
However, I have a required field within the multigroup and now I get something like that: RequiredField is empty.
I haven't checked yet. if it works without required fields.
#2
Hi everybody,
as I mentioned in my previous post, I was not able to validate required field residing inside a multigroup of a content_profile node type. I managed to debug the problem and even find a solution:
<?php. $form += array('#field_info' => array());
. $form['#field_info'] += $node_form['#field_info'];
+ $form += array('#after_build' => array());
+ foreach ($node_form['#after_build'] as $key) {
+ if (!in_array($key, $form['#after_build'])) {
+ array_unshift($form['#after_build'], $key);
+ }
. }
. $form += $form_add;
?>
The main problem, why the validation of required fields in multigroups doesn't work, is because the content profile's
$node_form['#after_build']values are not copied by the following line:<?php$form += $form_add;
?>
Doing it like the
$node_form['#field_info']in the sample also didn't work, because it won't replace the values properly. This is why I added the lines with the +.However there is one more tweak:
<?php. // Copy over any fieldgroups
. $keys = array_keys($node_form);
. foreach ($keys as $key) {
. if (stristr($key, 'group_')) {
. $form_add[$key] = $node_form[$key];
+ } else if ($key == '#multigroups') {
+ $form_add[$key] = $node_form[$key];
. }
. }
?>
I also made sure, that the
'#multigroup' items will be copied along with the group items.Note, that all 'groups_' and '#multigroups' will be copied regardless of the user registration settings that specify which fields to hide, but this is something I can live with.
HTH
#3
Hi there,
here is another patch (which replaces the previous) that fixes an issue with the latest (greatest) CCK3 as of 11/5/09.
It simply is the same thing that Cristhian did on
node_validatetwo lines below oncontent_validate.BTW: both patches were made against DRUPAL-6--1-0-BETA4
Cheers