Support » Plugin: LH User Taxonomies » In User listing, no commas separating terms

  • Resolved parakeet

    (@parakeet)


    Where I have registered new taxonomy “Topics”, registered to “users”, the “Topics” column displays successfully on the back-end Users list.

    But, where a user is attached to multiple terms, those terms do not appear with comma-and-space separation. This makes it hard to distinguish between terms.

    See example: http://i.imgur.com/yUvFyNt.png

    Am I doing something wrong?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter parakeet

    (@parakeet)

    This relates to your function lh_user_taxonomies_get_user_taxonomies

    	/**
    	 * Just a private function to
    	 * populate column content
    	 */
    	private function lh_user_taxonomies_get_user_taxonomies($user, $taxonomy, $page = null) {
    $terms = wp_get_object_terms( $user, $taxonomy);
    		if(empty($terms)) { return false; }
    		$in = array();
    		foreach($terms as $term) {
    			$href = empty($page) ? add_query_arg(array($taxonomy => $term->slug), admin_url('users.php')) : add_query_arg(array('user-group' => $term->slug), $page);
    			$in[] = sprintf('%s%s%s', '<a href="'.$href.'" title="'.esc_attr($term->description).'">', $term->name, '</a>');
    		}
    	  	return implode('', $in);
    	}

    I have modified the implode to include a comma separation, after learning a little about implode

    return implode(', ', $in);

    This introduces comma separation in the column when there are multiple terms attached.

    Plugin Author shawfactor

    (@shawfactor)

    I’ll incorporate into trunk, although I’ll need to add a trim to the final output

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘In User listing, no commas separating terms’ is closed to new replies.