bayan.assaf (@bayanassaf)

Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)

  • bayan.assaf
    Participant

    @bayanassaf

    Hello Ben,

    Add this function to your functions.php file:

    add_filter( ‘bbp_after_get_the_content_parse_args’, ‘bavotasan_bbpress_upload_media’ );
    /**
    * Allow upload media in bbPress
    *
    * This function is attached to the ‘bbp_after_get_the_content_parse_args’ filter hook.
    */
    function bavotasan_bbpress_upload_media( $args ) {
    $args[‘media_buttons’] = true;

    return $args;
    }

    This adds an “Add media” button to the write panel.


    bayan.assaf
    Participant

    @bayanassaf

    You can add the following code in your functions.php file:

    add_action(‘media_buttons’, ‘ml_pre_media_buttons’, 1);
    add_action(‘media_buttons’, ‘ml_post_media_buttons’, 20);
    function ml_pre_media_buttons($editor_id) {
    if (!$editor_id == ‘bbp_reply_content’)
    return;

    $GLOBALS[‘post_temp’] = $GLOBALS[‘post’];
    $GLOBALS[‘post’] = null;
    }
    function ml_post_media_buttons($editor_id) {
    if (!$editor_id == ‘bbp_reply_content’)
    return;

    $GLOBALS[‘post’] = $GLOBALS[‘post_temp’];
    }


    bayan.assaf
    Participant

    @bayanassaf

    Hello,

    Here is your solution:
    Add the following to functions.php file in your child theme:

    add_action(‘media_buttons’, ‘ml_pre_media_buttons’, 1);
    add_action(‘media_buttons’, ‘ml_post_media_buttons’, 20);
    function ml_pre_media_buttons($editor_id) {
    if (!$editor_id == ‘bbp_reply_content’)
    return;

    $GLOBALS[‘post_temp’] = $GLOBALS[‘post’];
    $GLOBALS[‘post’] = null;
    }
    function ml_post_media_buttons($editor_id) {
    if (!$editor_id == ‘bbp_reply_content’)
    return;

    $GLOBALS[‘post’] = $GLOBALS[‘post_temp’];
    }

    Reference: https://bbpress.org/forums/topic/solved-only-keymasters-admin-can-upload-images/

Viewing 3 replies - 1 through 3 (of 3 total)