WordPress.org

Ready to get started?Download WordPress

Forums

Co-Authors Plus
[resolved] Duplicates on Authors page (21 posts)

  1. samueljohnw
    Member
    Posted 1 year ago #

    After installing the plugin I get duplicates on my authors page.

    http://awakenmag.com/author/bethanyreid/

    Deactivating the plugin makes the articles throw an error and they won't display.

    http://wordpress.org/extend/plugins/co-authors-plus/

  2. Jamil Jonna
    Member
    Posted 1 year ago #

    I just realized I have this same problem. To boot, the authors are missing in the back end for nearly all of my posts! I cannot even find any systematic reason for why this happened. Aside from creating short codes for coauthors in some places, the only additional code I have for coauthors plus is the following:

    function add_pagination_to_author_page_query_string($query_string){
    	   if (isset($query_string['author_name'])) $query_string['post_type'] = array('post', 'books' , 'attachment');
    	   return $query_string;
    	}

    This simply makes sure that coauthors attached to my custom post type, "books," appear in author post listings.

    This really sucks. Only the first author appears now on the actual post but the if there were any coauthors have, they have vanished. In addition, when I fixed one of my posts (which had no authors listed) by adding the author and coauthor, the author listing only brought up that individual post—even though I know this author has many posts, and not just custom "books" posts, which is what I edited.

  3. Jamil Jonna
    Member
    Posted 1 year ago #

    One thing that I noticed is that this appears only to affect the authors of my custom posts. However, these are the only posts that have multiple authors.

    Here is the various shortcut code that I use in case it might be helpful.

    /* Custom shortcode */
    
    	add_shortcode( 'mr-coauthor-link-inline', 'mr_coauthor_inline_shortcode' );
    	function mr_coauthor_inline_shortcode() {
    		global $post;
    		$isedited = get_post_meta( $post->ID, 'Editors', true );
    		$contributor = get_post_meta( $post->ID, 'Contributor', true );
      	if ( function_exists('coauthors_posts_links') && !empty( $isedited ) && !empty( $contributor ) )	{
      		coauthors_posts_links(', ', '<em>' . $contributor . '</em> ', ' <em>' . $isedited . '</em> <span class="coauthors-yarp ed-contrib">' , '</span>' );
    			 	}
      	else if ( function_exists('coauthors_posts_links') && !empty( $isedited ) )	{
      		coauthors_posts_links(', ', ' and ', ' <em>' . $isedited . '</em> <span class="coauthors-yarp ed">' , '</span>' );
    			 	}
    	else if ( function_exists('coauthors_posts_links') && !empty( $contributor ) )	{
      		coauthors_posts_links(', ','<em>' . $contributor . '</em> ', ' <em>by</em> <span class="coauthors-yarp contrib">' , '</span>' );
    			 	}
    	else if ( function_exists('coauthors_posts_links') && empty( $isedited ) )	{
    		coauthors_posts_links(', ', ' and ', ' <em>by</em> <span class="coauthors-yarp">' , '</span>' . $contributor );
    			 	}
    	else if (!function_exists('coauthors_posts_links'))	{
    		the_author_posts_link();
    		}
    	}
    
    	add_shortcode( 'mr-coauthor-link', '
    	function mr_coauthor_shortcode() {
    		global $post;
    		$isedited = get_post_meta( $post->ID, 'Editors', true );
    	  	$contributor = get_post_meta( $post->ID, 'Contributor', true );
      	if ( function_exists('coauthors_posts_links') && !empty( $isedited ) && !empty( $contributor ) )	{
      		coauthors_posts_links(', ', '<em>' . $contributor . '</em> ', ' <div class="byline"><em>' . $isedited . '</em> <span class="coauthors">' , '</span>' );
    			 	}
      	else if ( function_exists('coauthors_posts_links') && !empty( $isedited ) )	{
      		coauthors_posts_links(', ', ' and ', ' <div class="byline"><em>' . $isedited . '</em> <span class="coauthors">' , '</span>' );
    			 	}
    	else if ( function_exists('coauthors_posts_links') && !empty( $contributor ) )	{
      		coauthors_posts_links(', ', '<em>' . $contributor . '</em> ', ' <div class="byline"><em>by</em> <span class="coauthors">' , '</span>' );
    			 	}
    	else if ( function_exists('coauthors_posts_links') && empty( $isedited ) )	{
    		coauthors_posts_links(', ', ' and ', ' <div class="byline"><em>by</em> <span class="coauthors">' , '</span>' . $contributor );
    			 	}
    	else if (!function_exists('coauthors_posts_links'))	{
    		the_author_posts_link();
    		}
    	}
  4. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    After installing the plugin I get duplicates on my authors page.

    Can you share the code used to generate the list of author posts on your site? Did you configure the site originally, or did someone else help you with it?

    Aside from creating short codes for coauthors in some places, the only additional code I have for coauthors plus is the following

    What is this hooked into?

    In addition, when I fixed one of my posts (which had no authors listed) by adding the author and coauthor, the author listing only brought up that individual post

    Have you written custom code for this author listing?

  5. samueljohnw
    Member
    Posted 1 year ago #

    Hey Daniel,

    I haven't used any custom code to generate the list. It only duplicates the posts on the authors template page when the plugin is enabled. Like this page:

    http://awakenmag.com/author/bethanyreid/

    I personally didn't configure the site. I am assisting someone in remedying the problem.

  6. Jamil Jonna
    Member
    Posted 1 year ago #

    What is this hooked into?

    functions.php for my theme. I'm just generating shortcodes and then altering the byline of my articles using the Hybrid theme (actually, the Prototype theme that uses the Hybrid framework. http://themehybrid.com)

    Have you written custom code for this author listing?

    I'm not sure what you mean, but not for this author listing in particular. I simply add the aforementioned shortcodes in the appropriate places.

  7. gregrmay
    Member
    Posted 1 year ago #

    Hi! I'm having the same issue- duplicate articles show up on author pages. Samuel, I notice that we are using the same theme (Gonzo), which might go a way towards explaining it. I'd love any help towards fixing the problem!

    The author code is fairly complex, customized by the theme to output a special page. I've copied the two key files below, author.php and a second file that is called to loop.

    <?php get_header(); ?>
    
    <section id="omc-main" class="omc-main-author">	
    
    	<?php if (!is_paged()) { ?>	
    
    		<?php if ( get_the_author_meta( 'description' ) ) : ?>
    
    			<div id="omc-author-page">		
    
    				<?php
    				$name = get_the_author_meta( 'display_name' );
    				$last = get_the_author_meta( 'last_name' );
    
    				$website = get_the_author_meta( 'user_url' );
    				$twitter = get_the_author_meta( 'twitter' );
    				$facebook = get_the_author_meta( 'facebook' );
    				$linkedin = get_the_author_meta( 'linkedin' );
    				$youtube = get_the_author_meta( 'youtube' );
    				$google = get_the_author_meta( 'google' );
    				$soundcloud = get_the_author_meta( 'soundcloud' );
    				?>
    
    				<span id="omc-author-page-image"><?php  echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyten_author_bio_avatar_size', 104 ) ); ?>		</span>	
    
    				<h1><?php printf( __( 'About %s ', 'gonzo' ), get_the_author() ); ?><?php echo $last; ?></h1>
    
    				<p><?php the_author_meta( 'description' ); ?><p>
    
    				<?php if ($website !== '') {?><div class="omc-author-connect omc-author-website"><?php _e('Website', 'gonzo');?>: <a href="<?php echo $website; ?>"><?php echo $website; ?></a></div><?php } ?> 
    
    				<div id="omc-author-social-icons">
    
    					<?php if($twitter !== '') {?><a class="omc-author-twitter" href="<?php echo $twitter; ?>"></a><?php } ?>
    					<?php if($facebook !== '') {?><a class="omc-author-facebook" href="<?php echo $facebook; ?>"></a><?php } ?>
    					<?php if($google !== '') {?><a class="omc-author-google" href="<?php echo $google; ?>"></a><?php } ?>
    					<?php if($linkedin !== '') {?><a class="omc-author-linkedin" href="<?php echo $linkedin; ?>"></a><?php } ?>
    					<?php if($youtube !== '') {?><a class="omc-author-youtube" href="<?php echo $youtube; ?>"></a><?php } ?>
    					<?php if($soundcloud !== '') {?><a class="omc-author-soundcloud" href="<?php echo $soundcloud; ?>"></a><?php } ?>						
    
    					<br class="clear" />
    
    				</div><!-- /omc-author-social-icons -->					
    
    				<br class="clear" />
    
    			</div><!-- /omc-author-page -->
    
    		<?php endif; rewind_posts(); ?>
    
    	<?php } ?>
    
    	<div class="omc-cat-top"><h1><?php printf( __( 'Author Archives: %s', 'gonzo' ), "<em>" . get_the_author() . "</em>" ); ?></h1></div>
    	<div class="no-display"></div>
    
    	<?php get_template_part('loop', 'blog-style-2'); ?>
    
    </section><!-- /omc-main -->
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    This might be the offending piece though. It's a file called loop-blog-style-2.

    <?php
    if ( have_posts() ) : while ( have_posts() ) : the_post();
    $omc_review_enable =  get_post_meta(get_the_ID(), 'omc_review_enable', true);
    $omc_final_score =  get_post_meta(get_the_ID(), 'omc_final_score', true);
    $omc_final_percentage = $omc_final_score * 20 ;
    $format = get_post_format();
    if ( false === $format )
    $format = 'standard';
    ?>		
    
    <?php if ($format !== 'aside'){ ?>
    <article class="omc-blog-two omc-half-width-category" id="post-<?php the_ID(); ?>">
    <?php } ?>
    <?php if ($format == 'aside'){ ?>
    <article class="omc-blog-two omc-half-width-category advertisement" id="post-<?php the_ID(); ?>">
    <?php } ?>	
    
        <?php
          global $h_sticky;
          global $displayed;
          $home_page = get_option ('shareit_home', 0);
          if (!$displayed and $h_sticky && $home_page == 1) {
            echo $h_sticky;
            $displayed = true;
          }
        ?>
    	<div class="omc-resize-290 omc-blog">		
    
    		<?php $category = get_the_category(); ?>
    
    		<h3 class="omc-blog-two-cat"><a href="<?php echo home_url(); echo ('/?cat='.$category[0]->term_id); ?>"><?php echo $category[0]->cat_name; ?></a></h3>
    
    		<?php if ($omc_review_enable == 1) { ?><span class="omc-blog-two-stars-under leading-article"><span class="omc-blog-two-stars-over leading-article" style="width:<?php echo $omc_final_percentage; ?>%"></span></span><?php } ?>
    
    		<a href="<?php the_permalink();?>" >
    
    			<?php if ($format == 'video' || $format == 'audio') { ?><span class="module-a-video-icon-big omc-half-width-icon omc-module-b-left"></span><?php } ?>
    
    			<?php if (has_post_thumbnail()) { 
    
    				the_post_thumbnail('half-landscape', array('class' => 'omc-image-resize')); 
    
    			} else {
    
    				echo('<img src="'.get_template_directory_uri().'/images/no-image-half-landscape.png" class="omc-image-resize" alt="no image" />');
    
    			} ?>
    
    		</a>
    
    	</div><!-- /omc-resize-290 -->
    
    	<div class="omc-blog-two-text">
    
    		<h2><a href="<?php the_permalink();?>"><?php the_title();?></a></h2>
    
    <?php if ($format !== 'aside'){ ?>
    
    		<p class="omc-blog-two-date"><?php the_time('F jS, Y') ?> | <em><?php _e('by', 'gonzo'); ?>
    
    <?php if ( function_exists( 'coauthors_posts_links' ) ) { ?>
    <?php coauthors_firstnames()?></em></p>
    <?php } else { ?>
    <?php the_author() ?></em></p>
    <?php } ?>
    
    <?php } ?>	
    
    		<p class="omc-blog-two-exceprt" ><?php wpe_excerpt('blog_2', 'wpe_excerptmore'); ?></p>
    
    		<br class="clear" />
    
    	</div><!-- /omc-blog-two-text -->
    
    </article>
    
    <?php endwhile;  endif; ?> 
    
    <br class="clear" />
    
    <?php kriesi_pagination(); wp_reset_query(); ?>
  8. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    Thanks for taking the time to share your files, gregrmay. Nothing pops out right away at me :/

    Sam: I notice the posts aren't duplicated on your site anymore. Did you track it down?

  9. gregrmay
    Member
    Posted 1 year ago #

    Thanks for taking a look! I posted on the theme designer's forums as well.

    I believe Sam stopped using the co-authors plugin, as did I, at least until I can figure out what is causing the issue.

    One additional clue: at least for me, the duplication only happens for authors who do not have enough posts to reach a second page. Authors with enough articles to be paginated do not have this issue, it seems.

    Happy to play around with some code if you have any suggestions!

  10. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    I don't — sorry. It sounds like this is a theme issue.

  11. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    Actually, I think I may have tracked this down based on some debugging I did this afternoon with a friend. Did you edit the user_nicename value for any of the authors that have duplicate posts by chance?

  12. gregrmay
    Member
    Posted 1 year ago #

    Yes, though I believe that I edited the nicename for all authors, so that doesn't seem likely to be the only culprit?

  13. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    @gregrmay I've detailed the problem and how you might fix it in another thread. Let's continue the discussion there.

  14. Markus Stefanko
    Member
    Posted 1 year ago #

    I feel this discussion might have become sidelined. Just to touch on the original topic, I am getting duplicates on my author page. This is the author.php code :

    <?php get_header(); 
    
    if(isset($_GET['author_name'])
    ) :
    $curauth = get_userdatabylogin($author_name);
    else :
    $curauth = get_userdata(intval($author));
    endif;
    
    if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <li>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>">
    <?php the_title(); ?></a>,
    <?php the_time("d M Y"); ?>
    </li>
    <?php endwhile; else: ?>
    <p><?php _e("No posts by this author."); ?></p>
    <?php endif; ?> 
    
    <?php get_footer(); ?>

    Gives me sometimes 3x and 4x results for some posts. This is after installing the co-author plugin, and this is for authors who posted in the past ( no new posts since plugin was installed )

  15. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    @disagree Are your user_nicenames different than your user_logins? If so, here's an outline of the problem and how to fix it.

  16. Markus Stefanko
    Member
    Posted 1 year ago #

    Only the capitalization, e.g. user_login = ABC, user_nicename = abc

  17. Markus Stefanko
    Member
    Posted 1 year ago #

    After I changed the user_nicename to ABC, the problem persists.

  18. Markus Stefanko
    Member
    Posted 1 year ago #

    I suppose this is why 4 out of 4 people reported this plugin broken. Is there no way for you to fix this in general terms on the plugin side? The SQL fumbling is not a good option.

    Any way to use the IDs instead of the user_nicenames, since that's what they're for?

  19. Daniel Bachhuber
    Hand Built
    Plugin Author

    Posted 1 year ago #

    I didn't expect this to be an issue. I'll see what I can do about putting together an upgrade script you can use. People typically only report whether it works or not if it's broken.

  20. Cssmeasap
    Member
    Posted 1 year ago #

    Hi Daniel,

    Was is possible to put together an upgrade script for this? I am having the same problem.
    Thanks!

  21. justkristin
    Member
    Posted 1 year ago #

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic