Squidster in IRC mentioned wanting to be able to put fields from profile.module on the main accounts page. I had a few ideas... Here's one of them.

Note -- Table alter is needed, haven't bothered to write the update blurb yet, so here's a mysql query.

ALTER TABLE profile_fields ADD COLUMN onfront TINYINT(1) NOT NULL DEFAULT 0;

(This patch is against DRUPAL-4-7 for reason of the person requesting said feature runs it, obviously will reroll against a more bleeding edge branch sometime... ;)

This version is not core-worthy, but aspires to be someday ;)

--Brandon

Comments

bdragon’s picture

StatusFileSize
new5.25 KB

I missed part of the INSERT query.

Squidgy’s picture

Awesome dude - thanks so much again for building this!

For those who're curious, here's a pair of screenies of the results of this patch.
Edit User Page
Edit profile field

Oh, and by the way, is this really for 6.x...? =P

sime’s picture

very nice

neofactor’s picture

This should be CORE now... not ver 6!

I would also like to see either a module or a hack to do the following: On the top of user account, a message from the admin could appear letting users know that there are new profile fields that need filling out. They could be forced to fill it out before moving on.

Thoughts?

neofactor’s picture

Title: Allow profile fields to appear on the main page » Check this out

Check this out: http://drupal.org/node/35728

MyPage like user account page.

bdragon’s picture

Title: Check this out » Allow profile fields to appear on the main page

Please read the note right under the Title field next time. :-|

(fixing title)

mvc’s picture

Thanks, this patch is great. Just one small point: it's "separate" not "seperate".

aerowalk’s picture

Just found a bug on this patch
This patch will save profile values in user->data
Thus, making profile searching (eg. search user by country, or first name, etc) become misserable @_@

aerowalk’s picture

I've just created a fix
put this code in user_save (in user.module), just before return $user;

  $fields = db_query('SELECT fid, name FROM {profile_fields}');
  while($field = db_fetch_object($fields)) {
    $fids[$field->fid] = $field->name;
  }
  if (isset($fids)) {
    $updated_data = array();
    // Extract any profile values from the user's data.
    if (is_array($data)) {
      foreach($data as $key => $value) {
        if (!in_array($key, $fids)) {
          $updated_data[$key] = $value;
        }
        elseif ($value) {
          // reinsert profile data into profile_values table.
		  db_query("DELETE FROM {profile_values} WHERE fid = %d AND uid = %d", array_search($key, $fids), $user->uid);
		  if (is_array($value)) {
		  	$value = serialize($value);
		  }
          db_query("INSERT INTO {profile_values} (fid, uid, value) VALUES (%d, %d, '%s')", array_search($key, $fids), $user->uid, $value);
        }
      }
      // reinsert the cleaned data for the user
      $updated_data = serialize($updated_data);
      db_query("UPDATE {users} SET data = '%s' WHERE uid = %d", $updated_data, $user->uid);
    }
  }

so far it works for me... =/

MattKelly’s picture

Has anyone else given this patch by aerowalk, combined with bdragon's, a test?

bdragon’s picture

Status: Active » Needs work
StatusFileSize
new4.63 KB

Attaching this so I don't lose it.

My original patch rerolled aginst DRUPAL-5 (can't remember how recent...). Still has the typo and all that, but should be easier to apply to a Drupal 5 site now.

MattKelly’s picture

This works great; is there any way we can get this into core?

beginner’s picture

Version: 6.x-dev » 7.x-dev
walker2238’s picture

hey I used this patch for version 5.7 but funny thing is that when I add the guestbook module to my profiles page the custom profile fields entered by the user become blank after the user clicks on the delete message link from the guestbook module.

damien tournoud’s picture

Status: Needs work » Closed (won't fix)

The profile module is obsolete. Won't fix.