Support » Plugin: Poll, Survey, Form & Quiz Maker by OpinionStage » incorrect load and errors logs in admin mode

  • Resolved jonathanmoorebcsorg

    (@jonathanmoorebcsorg)


    opinionstage-article-placement-functions.php includes code like:

    			global $post;
    			$type = $post->post_type;

    This fails in various situations where no global post variable is available, so logging errors as:
    PHP Notice: Trying to get property of non-object in wp-content/plugins/social-polls-by-opinionstage/includes/opinionstage-article-placement-functions.php on line 13

    note that in opinionstage-polls.php only one of the requires is inside is_admin and no check for admin ajax either:

    	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' );
    	}

    While one can fix this error by testing whether $post is initialised, there’s a wider issue that opinionstage-article-placement-functions.php and others are being loaded all the time including various ajax and admin situations where presumably it can’t be needed.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘incorrect load and errors logs in admin mode’ is closed to new replies.