af.
Forum Replies Created
-
Forum: Plugins
In reply to: [Co-Authors] Co-authors not saving author infoI’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…
co-authors.php
@@ -329,6 +329,7 @@ function coauthors_modify_post_sidebar(){ global $current_user; + global $post; //if($current_user->has_cap('edit_others_posts')){ 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='https://new-wineskins.org-beta/wp-includes/js/jquery/jquery.js?ver=1.1.4'></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
admin.js
@@ -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(); coauthors_check_first_delete_disabled_state();
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!
Forum: Plugins
In reply to: Page with custom URL parameter redirectsGave up waiting for replies ??
For future reference, year does appear to be reserved so I just changed to y and it now works as I want.
Forum: Networking WordPress
In reply to: current_user_can broken using multisiteThanks, changing the argument from the subscriber role to a different capability seems to have worked ??
Forum: Networking WordPress
In reply to: current_user_can broken using multisiteI haven’t started using any other subsites yet though so surely all the users from before the switch should be listed as users of the (main) site that this code is on?
Also, I am negating the current_user_can(‘subscriber’) so even if it was returning false then that shouldn’t matter…