[wp-hackers] Custom list of posts per user
otto at ottodestruct.com
Wed Sep 15 11:00:57 UTC 2010
On Wed, Sep 15, 2010 at 5:39 AM, Mike Schinkel
<mikeschinkel at newclarity.net> wrote:
>> Remember that you can have multiple meta values with the same key, so you
>> don't need serialization at all.
>> You just have to decide which table makes more sense: postmeta or usermeta.
> If it's purpose is to store a bigint foreign key in a longtext field, especially if you might need to index on it, I'd say neither makes more sense. JMTCW.
That really depends on your use cases. How is he using this data? Are
you always retrieving all the data for each user? Do you need to join
on it? If you don't need to do every possible thing with it, then you
don't have to go all normal form on it, and you can get optimizations
that you wouldn't have otherwise.
The custom taxonomy idea he had is basically how bbPress implements
email subscriptions. It has a bb_subscribe taxonomy hooked to the
bb_user table. The objects are user id's, the terms are topic-X where
X is the id number of the topic. So when somebody subscribes to a
topic, the code calls set_object_terms to add that term to the user
object. When a new post is made, all the objects with that term are
pulled out and the id's are the id's of the users subscribed to the
Using the user_meta would be quicker if a) the number of items in the
list was small and b) you didn't need to access them in the reverse
direction (that is, you only ever pulled the list for a single user,
not a list of users who had the item in their lists).
More information about the wp-hackers