I noticed that the profile module has 2 inconvenients:

  1. it saves empty items
  2. it can't accept empty dates

I patched the cvs profile.module and form.inc to do the following things:

  • allow users to enter empty dates in the edit profile page (by adding the '--' option in the date fields)
  • optionally set an empty date to the current date (using the autocomplete field) in the edit profile page
  • don't save empty profile fields

The attached patch works on profile.module v1.160 and form.inc v1.128.

Comments

LAsan’s picture

Version: x.y.z » 7.x-dev

Does this patch applies on cvs?

Xacro’s picture

Thanks! This patch really helped me. Before, I couldn't find any way to delete profile date fields without directly manipulating the database.

I did find, however, that this bit of code (in profile.module):

        if (!$field->required) {
                $fields[$category][$field->name]['#default_value'] = NULL;
        }

that was added caused the date fields to default to nothing even when legitimate dates had been set previously. I am, however, using Drupal 6.4... so the problem might be that. Some of the patching actually failed, so I had to go in and do it myself. I'm not too good at PHP, but after I commented out those lines and things look like they're working properly...

drupal_was_my_past’s picture

Status: Active » Closed (won't fix)

Profile has been removed from core #301071: Remove profile module from core.

ttkaminski’s picture

StatusFileSize
new1.24 KB

Attached is a patch that deletes empty profile values instead of inserting them. This patch applies cleanly to 7.x-dev. You can run these queries to clean up the existing table:

DELETE FROM profile_value where value is null;
DELETE FROM profile_value where value='';

This significantly reduced the size of our database, which had several million users and most users do not fill out their profiles.