Frank
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Media Uploader on Comment Box needs the Right to edit_others_postsThis is the solution for me. Setting the $post->ID to zero means that attachments have no parent. See the comments.
function twentytwelve_wp_editor(){ global $post; ob_start(); // For later restore via Javascript: print '<input type="hidden" id="real_post_id" name="real_post_id" value="' . $post->ID . '">'; $post->ID = 0; // Since this will be the parent of attached media! wp_editor( '', 'comment' ); return ob_get_clean(); } function twentytwelve_comment_form_defaults($args) { if ( current_user_can( 'publish_posts' ) ) { $args['comment_field'] = twentytwelve_wp_editor(); } return $args; } add_filter( 'comment_form_defaults', 'twentytwelve_comment_form_defaults' ); // More allowed tags for authors: function authors_allowed_tags() { if ( ! current_user_can( 'publish_posts' ) ) return; global $allowedtags; $allowedtags['ul'] = array(); $allowedtags['ol'] = array(); $allowedtags['li'] = array(); $allowedtags['img'] = array( 'width' => true, 'height' => true, 'src' => true, 'alt' => true ); $allowedtags['span'] = array( 'style' => true ); $allowedtags['p'] = array( 'style' => true ); } add_action( 'init', 'authors_allowed_tags' ); function restore_post_ID() { // Restore the real post ID so the comment can be attached to it: ?> <script type="text/javascript">jQuery('#comment_post_ID').val(jQuery('#real_post_id').val());</script> <?php } add_action( 'wp_footer', 'restore_post_ID' );
Forum: Fixing WordPress
In reply to: Media Uploader on Comment Box needs the Right to edit_others_postsWhat I figured out so far: the upload will work if the actual post is written by the same authenticated user who is about to comment ??
This is because the media uploader assigns the uploaded file to the actual post – what makes sense in a post creation or update context. But using the editor with file uploads in the comment context it seems the check for the edit_others_posts capability makes absolutely no sense, because it’s the normal, expected case that you’re NOT the only one commenting on your own posts.
What hackish thing is to do? To simulate somehow the commenting user is the post author? Looks not good. – To skip the assignment to a post at all as we do using the media library? Much better?! But how can I inject this into the comment editor instance?
Forum: Plugins
In reply to: [Display Posts - Easy lists, grids, navigation, and more] Only showing titleHave you visited the plugin’s wiki page and tried the appropriate attributes like
include_excerpt="true"
?Forum: Alpha/Beta/RC
In reply to: 3.5 rc2 – Plugin editor: navigation confusedSeems to be an old bug. Version 3.4.2 shows the same.
Clicking around between plugin files leads not only to loosing the appropriate plugin name shown in the select box (it shows the very first of the plugins list) but also sometimes to loosing file names from the shown list for a plugin. Strange.
Forum: Alpha/Beta/RC
In reply to: WP 3.5-RC1 – Embed options missing on media settings pageThanks for explanation.