Front end editor – Media Upload: Would like ability to pass post id
-
After having battled for some time trying to find out why only admins (keymaster) could upload images to replies in the bbPress 2 forum, I found out that this is not a bbPress issue.
The problem is that the Media buttons takes the post id to attach the media to from the current global post id, which would normally be the id of the page where the WP_Editor form is found.
This happens in the
media_buttons()
function ofwp-admin/includes/media.php
.The problem with this is, that in many (or most) cases, a WP_Editor form would be used to allow for the user to create a new post, and any pictures inserted with the media buttons would naturally belong to this new post.
The specific problem that this creates in bbpress has to do with permissions:
When submitting a reply to a forum topic, the uploaded images will try to attach themselves to the topic – not the new reply (which at the time doesn’t yet have an id).
This causes the upload to fail, unless the current user is also the creator of the topic or has the “edit_others_topics” set to true (which most users of course shouln’t have).
So my humble request is that an upcoming WP version will allow a post id to be passed to the
wp_editor()
function, or that a filter hook will be added tomedia_buttons()
so the use of the global post id can be overridden.
- The topic ‘Front end editor – Media Upload: Would like ability to pass post id’ is closed to new replies.