• Resolved laggedonuser

    (@laggedonuser)


    I have an installation of this program and discovered a bug. I have a notification bar that is scheduled on a single page, but it wasn’t displaying.

    I traced the issue down to the get_notification_bar_data() function in class-wp-notification-bars-shared.php. It was using $bar[0] as the value of $bar_id. But this was invalid. The $bar array contained 4 values since several other bars had been assigned to this page in the past. Somehow information was retained about all four bars. However, $bar[0] no longer existed and $bar[3], the last bar assigned, was actually the correct bar.

    I rewrote this to loop through the bars and make sure that valid metadata is found before returning. The other solution might be to use $bar[count($bar) – 1] since I think the last value of bar is the valid one, not the first value $bar[0].

    Anyway, here was my solution:

    
    if ( $bar && !empty( $bar ) ) {
        foreach ($bar as $bar_id) {
            if ( $bar_id && !empty( $bar_id ) ) {
                $meta_values = get_post_meta( $bar_id, '_mtsnb_data', true );
                if ($meta_values) {
                    $this->bar_id   = $bar_id;
                    $this->bar_data = $meta_values;
                    return;
                }
            }
        }
    }
    
    • This topic was modified 6 years, 9 months ago by laggedonuser.
Viewing 1 replies (of 1 total)
  • Plugin Author MyThemeShop

    (@mythemeshop)

    Hello @laggedonuser

    Sorry for any inconvenience that might have been caused due to that.

    We are glad that you have managed to fix the issue. We will check this issue on our end and get it fixed.

    Thank you.

Viewing 1 replies (of 1 total)
  • The topic ‘Bug in Showing Bar on Single Page’ is closed to new replies.