• Resolved dannypsg

    (@dannypsg)


    Hi!

    First, I would like to thank you for your work on this plugin… it is very well thought out.

    I have created a author list page which shows a list of all the wordpress site authors, a description.. and an image.

    I tried pasting the code provided with the plugin, but it is not displaying any images. Here is what I have so far:

    <?php
    /*
    Template Name: Display Authors
    */
    ?>
    <?php get_header(); ?>
    <?php
    // Get all users order by amount of posts
    $allUsers = get_users('orderby=post_count&order=DESC');
    
    $users = array();
    
    // Remove subscribers from the list as they won't write any articles
    foreach($allUsers as $currentUser)
    {
    	if(!in_array( 'subscriber', $currentUser->roles ))
    	{
    		$users[] = $currentUser;
    	}
    }
    
    ?>
    
    <section class="content" role="main">
    	<?php
    		printf('<h1>%s</h1>', the_title());
    
    		foreach($users as $user)
    		{
    			?>
    			<div class="authorlist">
    			<div class="authorlstleft">
    			<h2 class="authorName"><?php echo $user->display_name; ?></h2>
    			<div class="authorimagelst">
    <?php
        // Retrieve The Post's Author ID
        $user_id = get_the_author_meta('ID');
        // Set the image size. Accepts all registered images sizes and array(int, int)
    
        // Get the image URL using the author ID and image size params
        $imgURL = get_cupp_meta($user_id, 'thumbnail');
    
        // Print the image on the page
        echo '<img src="'. $imgURL .'" alt="">';
    ?>
    </div>
    				</div>
    				<div class="authorlstright">
    					<p class="authorDescrption"><?php echo get_user_meta($user->ID, 'description', true); ?></p>
    					<p class="authorLinks"><a href="<?php echo get_author_posts_url( $user->ID ); ?>">View Author Links</a></p>
    
    					<p class="socialIcons">
    						<ul>
    							<?php
    								$website = $user->user_url;
    								if($user->user_url != '')
    								{
    									printf('<li><a href="%s">%s</a></li>', $user->user_url, 'Website');
    								}
    
    								$twitter = get_user_meta($user->ID, 'twitter_profile', true);
    								if($twitter != '')
    								{
    									printf('<li><a href="%s">%s</a></li>', $twitter, 'Twitter');
    								}
    
    								$facebook = get_user_meta($user->ID, 'facebook_profile', true);
    								if($facebook != '')
    								{
    									printf('<li><a href="%s">%s</a></li>', $facebook, 'Facebook');
    								}
    
    								$google = get_user_meta($user->ID, 'google_profile', true);
    								if($google != '')
    								{
    									printf('<li><a href="%s">%s</a></li>', $google, 'Google');
    								}
    
    								$linkedin = get_user_meta($user->ID, 'linkedin_profile', true);
    								if($linkedin != '')
    								{
    									printf('<li><a href="%s">%s</a></li>', $linkedin, 'LinkedIn');
    								}
    							?>
    						</ul>
    					</p>
    				</div>
    			</div>
    			<?php
    		}
    	?>
    </section>
    
    <?php get_footer(); ?>

    Any help would be greatly appreciated!

    Thank You,
    Danny

    https://www.ads-software.com/plugins/custom-user-profile-photo/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter dannypsg

    (@dannypsg)

    Hello? Don’t forget about me please lol I would really appreciate it.

    3five

    (@3five)

    Hi Danny,
    We haven’t forgotten about you ?? We’re currently busy with client work and have not been able to investigate your issue. We will get to this ASAP and let you know what we can do to help you.

    Thanks,
    3five.

    Thread Starter dannypsg

    (@dannypsg)

    Thanks guys! I really appreciate it. Please let me know if you need any additional information.

    3five

    (@3five)

    Hi again Danny,
    I think i see the issue. You need to change the ID to the one found in your array because that code is in your foreach loop.

    Change this:

    // Retrieve The Post's Author ID
        $user_id = get_the_author_meta('ID');

    to this:

    // Retrieve The Post's Author ID
        $user_id = $user->ID;

    That should do the trick.

    Thanks,
    3five

    Thread Starter dannypsg

    (@dannypsg)

    That definitely did what I needed it to! Thank you! You guys rock! 5 star review headed your way

    3five

    (@3five)

    Thanks Danny! Much appreciated and happy coding!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Image on Author List page’ is closed to new replies.