if($wpdb->get_var('show tables like \''.$wpdb->avhec_cat_group.'\'')!=$wpdb->avhec_cat_group){
add_action('init',array(&$this,'doCreateTable'),2);// Priority needs to be the same as the Register Taxonomy
}
add_action('init',array(&$this,'doRegisterTaxonomy'),2);// Priority for registering custom taxonomies is +1 over the creation of the initial taxonomies
* As we don't want to see the Menu Item we have to disable show_ui. This also disables the metabox on the posts and pages, so we add thse manually instead.
* We remove the capabilities to manage, edit and delete the terms. We have written this part ourselves and don't use WordPress for these functions. The only one we use is the assign_terms.
* Get the categories from the given group from the DB
*
* @param int $group_id The Taxonomy Term ID
* @return Array|False categories. Will return FALSE, if the row does not exists.
*
*/
functiongetCategoriesFromGroup($group_id)
{
global$wpdb;
// Query database
$result=$wpdb->get_results($wpdb->prepare('SELECT * FROM '.$wpdb->terms.' t, '.$wpdb->avhec_cat_group.' cg WHERE t.term_id = cg.term_id AND cg.group_term_id = %d',$group_id));
if(is_array($result)){// Call succeeded
if(empty($result)){// No rows found
$return=array();
}else{
foreach($resultas$row){
$return[]=$row->term_id;
}
}
}else{
$return=false;
}
return($return);
}
/**
* Set the categories for the given group from the DB. Insert the group if it doesn't exists.