• Resolved hafman

    (@hafman)


    Hello,

    The plugin was working well for me and i managed to make some templates to return the tags at the front (with help from this support forum :). However, something strange has happened. Some Users’ tags are not showing despite being set in the profile page.

    Some links to the dev site…
    This is the tag archive with each user’s tags lined up Note: 2 are missing tags. These are the same 2 users throughout.
    https://dev.junction44.com/haf/tag/work_types/drawing/

    This is a page with the members listed
    https://dev.junction44.com/haf/members-gallery/

    A single user profile
    https://dev.junction44.com/haf/author/peterm/

    I’ve tried all the usual diagnostics, deactivate plugins, revert to original template and so on but this is elusive.

    I deleted a user and added them again, i added another and now no new users will show tags on these pages.

    Possibly something changed before the 2 culprit profiles were added and maybe it has to do with the way the tags are saved to the database?

    Any thoughts or pointers would be appreciated.

    https://www.ads-software.com/plugins/user-tags/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Umesh Kumar

    (@umeshsingla)

    Hi @hafman

    You are having issue with the profiles: Katherine Reekie and Peter Marsh, as I see it in the links.

    I can’t really think of a reason for the tags not being shown, can you possibly contact me through my email, so that I can directly debug it over your site.

    Cheers
    umeshsingla05[at]gmail.com

    Plugin Author Umesh Kumar

    (@umeshsingla)

    Hey @hafman,

    I’m marking the thread as resolved, as we had figured out the solution over email.

    Thanks for donating, also if you could please share the code over here, so that others can benefit from it.

    Also, if you could please leave a review of the plugin.

    Thanks and Cheers
    Umesh Kumar

    Thread Starter hafman

    (@hafman)

    Thanks for fixing this so quickly Umeesh. Will add the review soon.

    The code used is here for anyone that will find it useful.

    <?php // this can go in functions.php or in the top of the template file
    
    /**
     * Fetch all the terms for the user and return a required HTML for the template
     *
     * @param $user_id
     * @param $taxonomy
     *
     * @return string
     */
    function get_user_tag_list( $user_id, $taxonomy ) {
    	//Get all the tags assigned to user for the queried taxonomy
    	$user_tags = wp_get_object_terms( $user_id, $taxonomy->name );
    
    	$user_tag_content = '';
    	if ( ! is_wp_error( $user_tags ) && ! empty( $user_tags ) ) {
    		//Store the url of each term in array
    		$tag_list = array();
    		foreach ( $user_tags as $tag ) {
    			$term_url   = site_url() . '/' . $taxonomy->rewrite['slug'] . '/' . $tag->slug;
    			$tag_list[] = sprintf( '<a href="%s">%s</a>', $term_url, ucfirst( $tag->name ) );
    		}
    
    		//If we have tag list for the user
    		if ( ! empty( $tag_list ) ) {
    			$user_tag_content = '<div class="member-tags-list">' . implode( ' / ', $tag_list ) . '</div>';
    		}
    	}
    
    	return $user_tag_content;
    }
    
    ?>

    Thats the function, now call it in the templates

    <?php
    // echo the tags in a list of users
    $taxonomy = get_taxonomy('work_types');
    $user_tag_content = get_user_tag_list( $author_id, $taxonomy );
    echo $user_tag_content;
    ?>

    This is a different setup for the archive if you are using the code from the plugin: template user-tags/templates/user-taxonomy-template.php

    <?php
    
    // put the tags in the taxonomy archive loop (adapted from the plugin template)
    
    							$user_tag_content = get_user_tag_list( $user_id, $taxonomy );
    
    							$c = '
                                <div class="artist-member">
                                    <h4><a href="' . esc_url( get_author_posts_url( $user_id ) ) . '">' . get_the_author_meta( 'display_name', $user_id ) . '</a></h4>
                                    <div id="profile-pic" style="float:left; width:100px; height:100px; margin:0 10px 10px 0;">
                                        <a href="' . get_author_posts_url( $user_id ) . '" title="">
                                            <img src="' . $thumb . '" alt="" width="' . $width . '" height="' . $height . '" title="" />
                                        </a>
                                    </div>' . $user_tag_content . '
                                    <p>' . $trap . '</p>
                                    <hr style="border: 0; height: 0; border-top: 1px solid rgba(0, 0, 0, 0.1); border-bottom: 1px solid rgba(255, 255, 255, 0.3);"></hr>
                                </div>';
    
    							$template_content .= apply_filters( 'ut_tepmplate_content', $c, $user_id );
    
    						}
    
    						echo $template_content;
    
    ?>
    Thread Starter hafman

    (@hafman)

    I should add that the last example includes a few of my own variables for other items. the one that you need is
    . $user_tag_content .

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Some users not showing tags’ is closed to new replies.