WordPress.org

Ready to get started?Download WordPress

Forums

Front end editor - Media Upload: Would like ability to pass post id (1 post)

  1. rsm08
    Member
    Posted 1 year ago #

    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 of wp-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 to media_buttons() so the use of the global post id can be overridden.

Topic Closed

This topic has been closed to new replies.

About this Topic