[wp-hackers] Custom taxonomies for authors

Dion Hulse (dd32) wordpress at dd32.id.au
Sat Mar 13 06:57:20 UTC 2010


On Sat, 13 Mar 2010 18:48:48 +1200, scribu <scribu at gmail.com> wrote:

> On Sat, Mar 13, 2010 at 3:06 AM, Thomas Scholz <info at toscho.de> wrote:
>
>> 'usermeta' isn’t made for n:n-relationships. I’d rather use something  
>> like
>> this:
>>
>> register_taxonomy(
>>        'color',
>>        'user',
>>        array(
>>                'hierarchical'  => false,
>>                'label'                 => 'Color',
>>                'query_var'             => 'color',
>>                'rewrite'               => array('slug' => 'color')
>>        )
>> );
>>
>> But it doesn’t show any visible result (and I didn’t really expect it to
>> do).
>>
>> What would be the best way to implement this functionality?
>>
>
> The second argument should be 'post' instead of 'user'.
>
> What you really need is a 3 way relationship: post-color-user.
>
> From a database perspective, this can be done by adding a user_id column  
> to
> the wp_term_relationships table.
>
> It would involve some custom both on the admin side and on the front-end.

Personally i don't think creating it as a post taxonomy is what is needed  
here.

Thomas, I think the taxonomy way you are going about is the best method.
As you can see, The taxonomy data is not shown to you however, since  
WordPress doesnt handle taxonomies being applied to users.

You can visit /wp-admin/edit-tags.php?taxonomy=color directly and you'll  
be able to manage the Colours there.

You'll need to manually add a dropdown selection to the user edit page  
however based off that taxonomy data, you'd probably have to hook into  
'show_user_profile' & 'edit_user_profile' to add a new Table and table  
row, as well as saving that data manually through the action which fires  
when user data is updated...



Dion Hulse / dd32

Contact:
   e: contact at dd32.id.au
   msn: msn at d32.id.au
   skype: theonly_dd32
   Web: http://dd32.id.au/


More information about the wp-hackers mailing list