In Drupal, a username is unique, but not permanent. So, if you store a username in a table, and the username is later changed, you can end up with inconsistent data.

It looks like the recipients column in {pm_draft} is a text field with a comma-separated list of names. There are a few ways to clean this up:

  • Instead of storing user names, store user IDs.
  • Instead of manually comma-separating them, just serialize the contents of $message['recipients'].
  • Better yet, denormalize the data into a separate table with draft_ids and uids. That way, it's at least possible to query the recipients list, even if we don't actually need that functionality now.

Comments

chrisfree’s picture

Status: Active » Postponed

Marking as postponed. I just pushed a commit that stores the recipient list as serialized data and later retrieves the user name by UID. This fixes the issue, but I think the separate table is the best way to go. Time permitting, I'll add this later.