WordPress.org

Ready to get started?Download WordPress

Forums

User Groups
Echo user category (5 posts)

  1. heatstroke
    Member
    Posted 1 year ago #

    Hi!

    I need to echo the ID and Name of the user categories. That is, echo terms IDs and names. Is it possible? Any tip about the code?

    Thanks a lot and good job! ;)

    http://wordpress.org/extend/plugins/user-groups/

  2. toto
    Member
    Posted 1 year ago #

    I need the same thing. Please help. How to get current user group?

  3. Zack Katz
    Member
    Plugin Author

    Posted 1 year ago #

    Please describe your request further.

  4. toto
    Member
    Posted 1 year ago #

    <?php
        function replace_id_for_slug($option){
        	$categories = get_categories("hide_empty=0&taxonomy=product_tag");
        	preg_match('/value="(\d*)"/', $option[0], $matches);
        	$id = $matches[1];
        	$slug = "";
        	foreach($categories as $category){
        		if($category->cat_ID == $id){
        			$slug = $category->slug;
        		}
        	}
        	return preg_replace("/value=\"(\d*)\"/", "value=\"$slug\"", $option[0]);
        }
    
              $select = wp_dropdown_categories("taxonomy=product_tag&hierarchical=1&show_count=1&echo=0");
    
        $select = preg_replace("#<select([^>]*)>#", "<select$1 onchange='return this.form.submit()'>", $select);
        $select = preg_replace_callback("#<option[^>]*>[^<]*</option>#", "replace_id_for_slug", $select);
        $select = str_replace("cat","product_tag",$select);
        echo $select;
        ?>
  5. Kenan
    Member
    Posted 1 year ago #

    I have an invoice template, and I would like to echo current user's group name inside that template.
    I tried this:

    $terms = get_terms( 'user-group' );
    echo ($user->user-group);

    but, of course, it's not working. It just echo 0.
    How to do that?
    Thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic