This is a patch for profile.module:

- Update_80() for profile fields was broken in updates.inc 1.12. This looks like it was caused by a bad merge. I restored the 1.11 version.

- Reimplemented the birthday/date functionality from 4.4. The upgrade path in updates.inc was altered for this. The date field does not suffer from pre-1970 issues, and follows the configured date format on the site.

- Changed private fields so that they show up for administrators, or for users who are viewing their own profile. Private fields have a notice below them, like on the editing form. I had to change checkboxes to use form_item() for this to work (looks the same).

- Removed double filtering. All fields are now checked only once, and the profile.module's own HTML is not stripped out anymore. I replaced the long drupal_specialchars + ENT_QUOTES call with the (equivalent) check_url().

- Tweaked the admin UI: added a 'no fields defined' message. Replaced the redundante "Create new field: Add new %type" with "Add new field: %type". Also added friendlier names for the field types (e.g. single/multi-line text field instead of textfield/textarea).

Note: due to update_80() being mangled, the patch is hard to read there. Here are the actually new lines:

array("Birthday", "birthday", "date", NULL, 0)

...

// Birthday format change:
if ($edit['birthday']) {
$edit['birthday'] = array('day' => $edit['birthday'], 'month' => $account->profile_birthmonth, 'year' => $account->profile_birthyear);
unset($account->profile_birthmonth);
unset($account->profile_birthyear);
}

If this patch is applied, the following issues should be checked again:
http://drupal.org/node/view/9798 - Fixed, I have the 'administer users' permission instead of yet another permission.
http://drupal.org/node/view/1418 - Fixed, I no longer use date() for the display. Issue should be changed to 4.4.x.
http://drupal.org/node/view/3847 - Fixed, issue should be changed to 4.4.x.
http://drupal.org/node/view/9944 - Fixed.

CommentFileSizeAuthor
profilepatch.txt23.5 KBSteven
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TDobes’s picture

Hooray! Putting date fields back into profile.module was on my ToDo list, but I never got around to it myself. Thanks!

Also, the renamed field types are MUCH clearer.

two small issue with the display of private fields:
1. In profile_view_profile, you reference $_GLOBALS... I think you mean $GLOBALS.

2. For the checkbox, list selection, and freeform list profile item types, these items are links when the user views them. Therefore, any user can view other users with the same profile data, regardless of the fields' "private" status. Perhaps we could add a user_access('administer users') to both (a.) viewing these pages and (b.) making those items links.

Other than that, a big +1 to the new functionality and improved UI in this patch.

Dries’s picture

I'm OK with this patch.

Steven’s picture

Applied a modified version to HEAD.
I fixed TDobes' suggestions: you can no longer browse private fields, unless you're an admin, and browsing links are also not generated unless you're allowed to browse a field.
I also added a 404 for unbrowsable fields: right now you get an SQL error instead (in case nosy people start plugging field names into the browse URL).

Anonymous’s picture