User Readable Profile Fields

kingandy - November 12, 2008 - 14:59
Project:User registration notification
Version:5.x-1.8
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Further to #271338: custom user profile fields are not coming through - though the mail is now delivering the profile values correctly, it is still displaying the system field name instead of thee user-readable field title (eg. 'profile_child_firstname: ' instead of 'First Name: '. I don't know if this is intentional, an oversight or due to a difference between 5.x and 6.x, but I believe the user-readable titles would be preferable. It's easy enough to achieve by switching 'f.name' for 'f.title' on line 86 (and the concordant $field->name references below).

<?php
      $result
= db_query('SELECT f.name, f.type, v.value FROM {profile_fields} f INNER JOIN {profile_values} v ON f.fid = v.fid WHERE uid = %d', $account->uid);
      while (
$field = db_fetch_object($result)) {
        switch (
$field->type) {
          case
'date':
           
$date_field = unserialize($field->value);
            if (
is_array($date_field)) {
             
$date_timestamp = mktime(0, 0, 0, $date_field['month'], $date_field['day'], $date_field['year']);
             
$profile_data .= sprintf("%s: %s\n", $field->name, format_date($date_timestamp));
            }
            break;
          case
'checkbox':
            if (
$field->value)
             
$account_data .= sprintf("%s: Checked\n", $field->name);
            else
             
$account_data .= sprintf("%s: Not Checked\n", $field->name);
            break;
          default:
           
$profile_data .= sprintf("%s: %s\n", $field->name, $field->value);
        }
?>

#1

rmiddle - November 12, 2008 - 15:34
Status:active» reviewed & tested by the community

Interesting Idea. Will keep this in mind for the next release.

#2

rmiddle - December 6, 2008 - 01:31
Status:reviewed & tested by the community» fixed

Committed to both 5.x & 6.x CVS. Will be in 1.9 release.

#3

System Message - December 20, 2008 - 01:32
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.