Support » Plugin: Co-Authors » Co-authors not saving author info

  • I’ve been using co-authors for a long time, but since my upgrade to WP 3.1.3, it’s developed a quirk I can’t figure out.

    When I create a draft with multiple authors, the author information does not survive between saves. For instance, I’ll create a draft, set the author names, and then save the draft. After saving, the author credit has reverted to just the first author on the list. This happens anytime the post is edited and re-saved.

    I can set the authors and then immediately publish, and it will save all authors, but if I go in to edit that post later, the information is gone again, and I have to re-add all authors just before hitting “update.”

    Does anyone have insight on why this might be happening?
    This is my site.
    Here is a post with multiple authors.

Viewing 4 replies - 1 through 4 (of 4 total)
  • I have the same problem. Also, additional authors seem to disappear from older posts as well.

    Hello there,
    did you guys figure out why the list of co-authors is not working in the backend anymore?

    Primeweb: I just ended up switching to co-authors plus. It was a pain initially, but worth it in the end.

    I’ve come up with a fix for this, so if you’re willing to edit about with your copy of the plugin code then here’s some diff patches…


    @@ -329,6 +329,7 @@
     function coauthors_modify_post_sidebar(){
     	global $current_user;
    +	global $post;
     		print '<script type="text/javascript">';
     		print 'var coauthors_can_edit_others_posts = ' . ($current_user->has_cap('edit_others_posts') ? 'true' : 'false') . "\n";
    @@ -339,6 +340,8 @@
     		#print 'var coauthors_moveUp_author_label = "' . __('+ Add author', 'co-authors') . '";';
     		#print 'var coauthors_moveDown_author_label = "' . __('+ Add author', 'co-authors') . '";';
     		#print 'var coauthors_delete_author_label = "' . __('+ Add author', 'co-authors') . '";';
    +		$coauthors_array = get_post_meta($post->ID, '_coauthor', false);
    +		print 'var coauthors_saved_authors = [' . (is_array($coauthors_array) ? implode(',', $coauthors_array) : '') . '];';
     		print '</script>';
     		//<script type='text/javascript' src=''></script>
    @@ -347,7 +350,7 @@
     		print '<script type="text/javascript" src="../' . PLUGINDIR . '/co-authors/admin.js"></script>';
    -add_action('admin_footer', 'coauthors_modify_post_sidebar'); //dbx_post_sidebar,edit_form_advanced
    +add_action('admin_footer-post.php', 'coauthors_modify_post_sidebar'); //dbx_post_sidebar,edit_form_advanced


    @@ -243,6 +243,14 @@
    +	//Fix by af to add in existing saved coauthors
    +	jQuery.each(coauthors_saved_authors, function(i, userID) {
    +		if (!addedAlready[userID]) {
    +			coauthors_add_coauthor(userID);
    +			addedAlready[userID] = true;
    +		}
    +	});
     	//Remove coauthor post meta select option
     	//jQuery("#metakeyselect option[value='coauthor']").remove();

    If anyone is interested, this bug exists because WordPress stopped printing “hidden” metadata fields (those beginning with underscores) in the “Custom Fields” box, which this plugin relied on to add the extra co-authors to the “Post Author” box. My fix simply prints this information elsewhere with the PHP then processes in accordingly in the JavaScript. Enjoy!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Co-authors not saving author info’ is closed to new replies.