I assume the code has to be somewhere here:
/**
* Add the taxonomies to the user view/edit screen
*
* @param Object $user - The user of the view/edit screen
*/
public function user_profile($user) {
// Using output buffering as we need to make sure we have something before outputting the header
// But we can't rely on the number of taxonomies, as capabilities may vary
ob_start();
foreach(self::$taxonomies as $key=>$taxonomy):
// Check the current user can assign terms for this taxonomy
//if(!current_user_can($taxonomy->cap->assign_terms)) continue;
// Get all the terms in this taxonomy
$terms = get_terms($key, array('hide_empty'=>false));
$stack = wp_list_pluck( wp_get_object_terms( $user->ID, $key ), 'slug' );
$input_type = ( isset($taxonomy->single_value) && ($taxonomy->single_value == true) ) ? 'radio' : 'checkbox' ;
?>
<table class="form-table">
<tr>
<th><label for=""><?php _e("Select {$taxonomy->labels->singular_name}")?></label></th>
<td>
<?php if(!empty($terms)): ?>
<?php $this->renderTree( $this->buildTree( $terms ), $stack, $user, $key, $input_type ); ?>
<?php else:?>
<?php _e("There are no {$taxonomy->name} available.")?>
<?php endif?>
</td>
</tr>
</table>
<?php endforeach; // Taxonomies
// Output the above if we have anything, with a heading
$output = ob_get_clean();
if(!empty($output)) {
echo '<h3>', __('Company Details'), '</h3>';
echo $output;
}
}
-
This reply was modified 6 years, 9 months ago by
paulovsky.