• Resolved julha

    (@julha)


    Hello,

    I’m currently using FileBird 2.2.

    When Filebird plugin is activated, the WordPress theme customizer stays blank and I get an error message in my developer console.

    Uncaught SyntaxError: Unexpected token <
    customize.php?url=http%3A%2F%2Flocal%2Fmy-site%2Fmy-page%2F:5078

    When I go to the error (by clicking the error line inside my developer console), I see a PHP error:

    line 5078

    Notice: Undefined index: label in C:\wamp\www\huge\wp-admin\includes\media.php on line 1844
    Call Stack
    # Time Memory Function Location
    1 0.0001 409888 {main}( ) …\customize.php:0
    2 0.1841 6265416 do_action( ) …\customize.php:265
    3 0.1841 6265792 WP_Hook->do_action( ) …\plugin.php:465
    4 0.1841 6265792 WP_Hook->apply_filters( ) …\class-wp-hook.php:310
    5 0.2060 6435344 WP_Customize_Manager->customize_pane_settings( ) …\class-wp-hook.php:286
    6 0.2504 6695000 WP_Customize_Site_Icon_Control->json( ) …\class-wp-customize-manager.php:4877
    7 0.2504 6695000 WP_Customize_Site_Icon_Control->to_json( ) …\class-wp-customize-control.php:331
    8 0.2504 6695000 WP_Customize_Site_Icon_Control->to_json( ) …\class-wp-customize-cropped-image-control.php:78
    9 0.2504 6695000 WP_Customize_Site_Icon_Control->to_json( ) …\class-wp-customize-upload-control.php:33
    10 0.2507 6696208 wp_prepare_attachment_for_js( ) …\class-wp-customize-media-control.php:111
    11 0.2561 6759552 get_compat_media_markup( ) …\media.php:3409

    There is no mention of one of your plugin files in this Call Stack, but when I deactivate FileBird, the customizer works fine.

    • This topic was modified 6 years, 11 months ago by julha.
    • This topic was modified 6 years, 11 months ago by julha.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Ninja Team

    (@ninjateam)

    Hi Julha,

    In this case, please use “Debug Info” plugin and give me a screenshot list of plugins, theme you are using. Then we will help you check it.

    Tommy

    Thread Starter julha

    (@julha)

    Hello,

    I found the error.
    The error appeared on the default Site Icon field of my theme customizer.

    There is a conflict between

    /wp-admin/includes/media.php
    > function get_compat_media_markup()
    >> apply_filters(‘attachment_fields_to_edit’)

    And

    /wp-content/plugins/filebird/includes/class-filebird-topbar.php
    > add_filter(‘attachment_fields_to_edit’)
    >> function get_compat_media_markup()

    The function currently return an empty field that is making the error.

    public function filebird_attachment_fields_to_edit($form_fields, $post)
    {
    
        // $dropdown_options = array(
        //     'show_option_all' => '- ' . __("Select", NJT_FILEBIRD_TEXT_DOMAIN) . ' -',
        //     'taxonomy'        => NJT_FILEBIRD_FOLDER,
        //     'name'=> 'attachments[' . $post->ID . ']['.NJT_FILEBIRD_FOLDER.']' ,
        //     'hide_empty'      => false,
        //     'hierarchical'    => true,
        //     'meta_key'        => 'folder_position',
        //     'orderby'         => 'meta_value',
        //     'show_count'      => true,
        //     'walker'          => new Walker_CategoryDropdown(),
        //     'value'           => 'id',
        //     'echo'            => false
        // );
    
        // $terms = wp_get_post_terms( $post->ID, NJT_FILEBIRD_FOLDER );
    
        // if(count($terms)){
    
        //     $dropdown_options['selected'] = $terms[0]->term_id;
        // }
    
        // $attachment_terms = wp_dropdown_categories( $dropdown_options );
    
        // $form_fields[NJT_FILEBIRD_FOLDER] = array(
        //     'label' => __('Folder', NJT_FILEBIRD_TEXT_DOMAIN),
        //     'input' => 'html',
        //     'html'  =>
        //         '<div class="njt-filebird-folder-edit">'
        //         . $attachment_terms .
        //         '</div>',
        // );
        $form_fields[NJT_FILEBIRD_FOLDER] = [];
        return $form_fields;
    }

    For those who can’t wait the plugin update, here is my hack to prevent the customizer from crashing:

    add_filter('attachment_fields_to_edit', function ($form_fields) {
      unset($form_fields[NJT_FILEBIRD_FOLDER]);
    
      return $form_fields;
    });
    • This reply was modified 6 years, 11 months ago by julha.
    Plugin Author Ninja Team

    (@ninjateam)

    Thank @julha,

    We fixed it and will release soon.

    Tommy

    Plugin Author Ninja Team

    (@ninjateam)

    Hi @julha

    That issue was fixed in FileBird 2.3 version. Please upgrade and let me know if you need any help from us 🙂

    Tommy

    Thread Starter julha

    (@julha)

    Hello, indeed the update resolved the issue.

    Thx for your reactivity.

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

The topic ‘Theme customizer BUG (FileBird 2.2)’ is closed to new replies.