When im using content profile, and showing some fields in the registration form, i need a certain field to be unique, so i used unique field module ( http://drupal.org/project/unique_field ), still its not working, this bug report (http://drupal.org/node/951772 ) seems to claim that this is a bug in content profile module . and that its not validating the node before saving when some fields are hidden in the registration form.

Comments

fago’s picture

Priority: Major » Normal

Content profile validates the form, but it only used node_validate() if the whole form included:

See:

    if (!in_array('other', content_profile_get_settings($type, 'registration_hide'))) {
      node_validate($node, $form);
    }
    elseif (module_exists('content')) {
      content_validate($node);
    }

Maybe it could be changed to always do a complete node_validate(), but this'd require quite some changes.

nohup’s picture

fago,

What kind of changes do you think will be needed if we always call node_validate?

All non required CCK fields are anyway listed in "Hide form fields:", if the auto_nodetitle module is installed, the function _content_profile_registration_get_field_select takes care of that as well. So the only field would be the body field of the content type, which the "other" setting is hiding.

On a simple test setup, I commented the if condition for "registration_hide" and let node_validate be called always, it worked. unique_field was able to validate the field and node body was not validated and was not visible as well.

What are the situations you think this will fail? I am willing to write up the patch to fix this.

danisha’s picture

I use content profile module and enabled a content type to be shown on registeration. The problem I am facing is that when there is an validation error on the registeration page, like username already exists, The content type is saved in the database. How is this happening i have no idea about it. Please give me a possible solution.