Viewing 12 replies - 1 through 12 (of 12 total)
  • Sona

    (@support-web-dorado)

    Dear bobmagne,

    You can send the credentials to [email protected]. Thank you.

    Hello,
    I have the same problem for some time!
    When I click on the button “add images”, nothing is happening. I have open the Javascript Console and i have this problem :

    “Uncaught TypeError: window.parent[callback] is not a function”
    File : default.js?ver=1.2.35 line 190 : “window.parent[callback](filesValid);”

    Last Version of WP and Last version of PhotoGallery.

    Thanks for your help, and sorry for my rough english. (I’m french)

    Sona

    (@support-web-dorado)

    Dear taymiri,

    Could you please first solve the Javascript error on the page? After that the issue will be fixed. Thank you.

    I don’t know how to fix this Javascript Error. I haven’t edit the sources files. I have make a latest version, and it’s OK.

    Regards.

    Sona

    (@support-web-dorado)

    Dear taymiri,

    The stated issues is not coming from our plugin. You have Javascript errors coming from other plugins/your theme. So please check that out. Thank you.

    Hello,
    (I wanted to say “previous version” and not “latest version”, in my last comment)

    However, i do not have this probleme with previous version, but the latest version don’t work. (with version 1.2.6, it’s ok, but not with version 1.2.38 for example) I tried to unable all plugins. But i have always this probleme.

    Regards

    Sona

    (@support-web-dorado)

    Dear taymiri,

    You might have an older version of jQuery used with your theme, which is no longer compatible with our gallery version. Please try updating it first. Thank you.

    Hello – I am getting this error as well, it is in the file manager when adding photos to a new gallery.

    The error is indeed coming from your plugin, specifically: /wp-content/plugins/photo-gallery/filemanager/js/default.js

    We are running the latest version of wordpress 4.4.2 which loads jQuery 1.11.2, which is only 1 minor revision from the latest of 1.11.3.

    It seems the: var callback = "bwg_add_image"; is not attaching to the window.parent after it’s code is executed in the admin-ajax.php

    Maybe this is a browser related problem? I am using Firefox 38.0.5

    actually… from the console, if I try to access bwg_add_image() function, it is not available.

    So when it is saying that window.parent[callback] is not a function, it actually is meaning that bwg_add_image isn’t available.

    I tracked down the problem.

    Line 455 of \photo-gallery\admin\views\BWGViewGalleries_bwg.php:
    else if (<?php echo $option_row->read_metadata; ?>) {
    that is coming out blank, so it’s outputting:
    else if() which is not valid and throws and unexpected token JS console error and doesn’t allow anything else to run so bwg_add_image function is never created.

    Now for the REASON behind the error, this is a WordPress Multisite issue. Your plugin does not properly activate when “Network Activated”. You can resolve this by adding the following to your main photo-gallery.php

    //Multisite Activation Checker
    function _bwg_activate($networkwide) {
        global $wpdb;
    
        if (function_exists('is_multisite') && is_multisite()) {
            // check if it is a network activation - if so, run the activation function for each blog id
            if ($networkwide) {
                        $old_blog = $wpdb->blogid;
                // Get all blog ids
                $blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
                foreach ($blogids as $blog_id) {
                    switch_to_blog($blog_id);
                    bwg_activate();
                }
                switch_to_blog($old_blog);
                return;
            }
        }
        bwg_activate();
    }

    and CHANGE
    register_activation_hook(__FILE__, 'bwg_activate');
    TO
    register_activation_hook(__FILE__, '_bwg_activate');

    This code will check for if a user Network Activates and bypass and execute the normal activate if they are not multisite.

    I have made the following changes to my local plugin and it works great! Merge this change and you can say your plugin is Multisite compatible ??

    You will also want to add the following to ensure that new blogs added after initial network activation get the proper tables created as well:

    add_action( 'wpmu_new_blog', 'new_blog_added', 10, 6);        
    
    function new_blog_added($blog_id, $user_id, $domain, $path, $site_id, $meta ) {
        global $wpdb;
    
        if (is_plugin_active_for_network('photo-gallery/photo-gallery.php')) {
            $old_blog = $wpdb->blogid;
            switch_to_blog($blog_id);
            bwg_activate();
            switch_to_blog($old_blog);
        }
    }

    For any of you out there with the Pro version, you’ll also want to handle the deactivation with replacing the function and hook registration with:

    //Multisite Deactivation
    function _bwg_deactivate($networkwide) {
        global $wpdb;
    
        if (function_exists('is_multisite') && is_multisite()) {
            // check if it is a network activation - if so, run the activation function for each blog id
            if ($networkwide) {
                        $old_blog = $wpdb->blogid;
                // Get all blog ids
                $blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
                foreach ($blogids as $blog_id) {
                    switch_to_blog($blog_id);
                    bwg_deactivate();
                }
                switch_to_blog($old_blog);
                return;
            }
        }
        bwg_deactivate();
    }
    
    /* On deactivation, remove all functions from the scheduled action hook.*/
    function bwg_deactivate() {
      wp_clear_scheduled_hook( 'bwg_schedule_event_hook' );
    }
    register_deactivation_hook( __FILE__, '_bwg_deactivate' );
Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Can't add images to gallery’ is closed to new replies.