Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter vivlad

    (@vivlad)

    I can suggest a solution like this.
    plugin.php:

    /* Some fuctions moved here */
    require_once( plugin_dir_path( __FILE__ ).'includes/opinionstage-utility-functions.php' );
    require_once( plugin_dir_path( __FILE__ ).'includes/opinionstage-sidebar-widget.php' );
    add_action('widgets_init', 'opinionstage_init_widget');
    /* Some fuctions moved here */
    
    // Check if another OpinionStage plugin already installed and display warning message.
    if (opinionstage_check_plugin_available('opinionstage_popup')) {
    	add_action('admin_notices', 'opinionstage_other_plugin_installed_warning');
    } else {
    	if(  (function_exists('wp_doing_ajax') && wp_doing_ajax()) || (defined('DOING_AJAX')) ){
        // AJAX running, don't include anything.
    	}else{
    		//require_once( plugin_dir_path( __FILE__ ).'includes/opinionstage-utility-functions.php' );
    		require_once( plugin_dir_path( __FILE__ ).'includes/opinionstage-article-placement-functions.php' );
    		//require_once( plugin_dir_path( __FILE__ ).'includes/opinionstage-sidebar-widget.php' );
    
    		if ( is_admin() ) {
    			require( plugin_dir_path( __FILE__ ).'admin/init.php' );
    		} else {
    			require( plugin_dir_path( __FILE__ ).'public/init.php' );
    		}
    
    		//add_action('widgets_init', 'opinionstage_init_widget');
    		add_action('plugins_loaded', 'opinionstage_init');
    	}
    }

    I’m not sure that this is completely correct, but it seems it works.
    Thank you.

    Thread Starter vivlad

    (@vivlad)

    Hello! Thanks for the quick response!

    We updated the widget to the latest version.
    But now we can not test it, because it can not be added to the sidebar.
    When we add the widget to the sidebar and specify the name of the widget, after clicking on the “Save” button it remains in the same mode:
    https://prnt.sc/kzaxs9
    Normal behavior for widgets – the button should switch to the “Saved” mode.
    If you then refresh the page, the widget disappears.
    If you look at the XHR query while saving the widget, you can see that the response is empty, and it should return the html code.
    The following entry appears in error.log:
    PHP Notice: Undefined index: opinionstage_widget-2 in [pathtofile] /wp-admin/includes/ajax-actions.php on line 2011, referer: [yoururl] /wp-admin/widgets.php

    We have tested it on two different fresh wordpress installation and behavior is the same

    Thanks

    • This reply was modified 6 years, 2 months ago by vivlad.
Viewing 2 replies - 1 through 2 (of 2 total)