• Resolved netzgestaltung

    (@netzgestaltung)


    Hi there,

    i get PHP warnings in Query Monitor regarding your Plugin:

    Undefined index: shownav wp-content/plugins/wp-post-comment-rating/inc/function.php:176
    Undefined index: wpcr_social wp-content/plugins/wp-post-comment-rating/inc/function.php:177

    Its regarding to the content filter in that file, while i have both options not active, the seem to be undefined with your method of getting options.

    global $wpdb, $post;
    $results = $wpdb->get_results( "SELECT option_value FROM ".$wpdb->prefix."options WHERE option_name = 'wpcr_settings'");
    $getval = unserialize($results[0]->option_value);
    $navval = $getval['shownav'];
    $wpcr_socialshare = $getval['wpcr_social'];

    you should check for existance of the array values befor accessing it:

    global $wpdb, $post;
    $results = $wpdb->get_results( "SELECT option_value FROM ".$wpdb->prefix."options WHERE option_name = 'wpcr_settings'");
    $getval = unserialize($results[0]->option_value);
    $navval = isset($getval['shownav']) ? $getval['shownav'] : false;
    $wpcr_socialshare = isset($getval['wpcr_social']) ? $getval['wpcr_social'] : false;

    as alternative you can get options the “normal” way so you could remove the global $wpdb:

    $wpcr_options = get_option('wpcr_settings');
    $navval = isset($wpcr_options['shownav']) ? $wpcr_options['shownav'] : false;
    $wpcr_socialshare = isset($wpcr_options['wpcr_social']) ? $wpcr_options['wpcr_social'] : false;
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘PHP Warnings’ is closed to new replies.