I’m working on this too
I’ve written the code to create media categories which could be based on users name as it would need to be unique.
This is what I’m playing around with so far.
For some reason I cannot get the parent to work as I can’t find what variable was used.
I now need to assign my uploaded images to specific categories. I could put a routine inside so that it runs at log in to create the users category and assign all their images to that category.
Has anyone else got anywhere with this?
Let me know….
function insert_category($category,$description,$parent) {
wp_insert_term(
$category,
‘media_category’,
array(
‘description’ => $description,
‘parent’ => $parent,
‘slug’ => $category //convert to lower case with hyphen
)
);
}
add_action(‘after_setup_theme’,’insert_category’);
$first_name =’John’;
$last_name =’Thomas’;
$user_id =’1021′;
$username =’thom_j’;
$parent_name =’Members Boats’;
$usercode = $first_name.’ ‘.$last_name.’ [‘.$user_id.’]’;
insert_category($username,$usercode,$parent_name);