bp_attachments_get_plupload_default_settings()

Get the BuddyPress Plupload settings.

Description

Return

(array) List of BuddyPress Plupload settings.

Source

File: bp-core/bp-core-attachments.php

606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
function bp_attachments_get_plupload_default_settings() {
 
    $max_upload_size = wp_max_upload_size();
 
    if ( ! $max_upload_size ) {
        $max_upload_size = 0;
    }
 
    $defaults = array(
        'runtimes'            => 'html5,flash,silverlight,html4',
        'file_data_name'      => 'file',
        'multipart_params'    => array(
            'action'          => 'bp_upload_attachment',
            '_wpnonce'        => wp_create_nonce( 'bp-uploader' ),
        ),
        'url'                 => admin_url( 'admin-ajax.php', 'relative' ),
        'flash_swf_url'       => includes_url( 'js/plupload/plupload.flash.swf' ),
        'silverlight_xap_url' => includes_url( 'js/plupload/plupload.silverlight.xap' ),
        'filters' => array(
            'max_file_size'   => $max_upload_size . 'b',
        ),
        'multipart'           => true,
        'urlstream_upload'    => true,
    );
 
    // WordPress is not allowing multi selection for iOs 7 device.. See #29602.
    if ( wp_is_mobile() && strpos( $_SERVER['HTTP_USER_AGENT'], 'OS 7_' ) !== false &&
        strpos( $_SERVER['HTTP_USER_AGENT'], 'like Mac OS X' ) !== false ) {
 
        $defaults['multi_selection'] = false;
    }
 
    $settings = array(
        'defaults' => $defaults,
        'browser'  => array(
            'mobile'    => wp_is_mobile(),
            'supported' => _device_can_upload(),
        ),
        'limitExceeded' => is_multisite() && ! is_upload_space_available(),
    );
 
    /**
     * Filter the BuddyPress Plupload default settings.
     *
     * @since BuddyPress 2.3.0
     *
     * @param array $settings Default Plupload parameters array.
     */
    return apply_filters( 'bp_attachments_get_plupload_default_settings', $settings );
}

Changelog

Changelog
Version Description
BuddyPress 2.3.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.