• Resolved Halil ESEN

    (@halilesen)


    Hi, it’s me again. ??

    After the 2.6.8 update, the code to show the notification count still doesn’t work.

    I tried many php combinations. It didn’t work. plainly

    <?php global $w3all_phpbb_unotifications;
      echo count($w3all_phpbb_unotifications);
    ?>

    When it is used, it shows 0, but there is actually a notification.

    You know, I usually use it in two ways. First:

    function add_notification_count_to_menu($item_output, $item, $depth, $args)
        {
            if ($args->theme_location == 'primary' && $item->title == '<i class="fas fa-comment"></i> Forumlar') {
    global $w3all_phpbb_unotifications;
    			if (!empty($w3all_phpbb_unotifications) && count($w3all_phpbb_unotifications) > 0){
                $item_output .= '<span class="bildirimvarbaksana">'. count($w3all_phpbb_unotifications) .'</span>';
    
            }
    		}
    
            return $item_output;
        }
    add_filter('walker_nav_menu_start_el', 'add_notification_count_to_menu', 10, 4);
    

    latter:

    <?php global $w3all_phpbb_unotifications; if (!empty($w3all_phpbb_unotifications) && count($w3all_phpbb_unotifications) > 0){ echo'<span class="bildirimvarnokta"></span>'; } ?>

    Not working. Of course, these don’t show anything because they have an if. Because as I just said, notifications show 0.

    I cleared the cache. I tried from incognito tab.

    What do you think is the problem?

    Thanks.

Viewing 3 replies - 16 through 18 (of 18 total)
  • Thread Starter Halil ESEN

    (@halilesen)

    I understand. The codes as follows:

    function add_notification_count_to_menu($item_output, $item, $depth, $args)
        {
            if ($args->theme_location == 'primary' && $item->title == '<i class="fas fa-comment"></i> Forumlar') {
    global $w3all_phpbb_unotifications;
    			if (!empty($w3all_phpbb_unotifications) && $w3all_phpbb_unotifications > 0){
                $item_output .= '<span class="bildirimvarbaksana">'. $w3all_phpbb_unotifications .'</span>';
    
            }
    		}
    
            return $item_output;
        }
    add_filter('walker_nav_menu_start_el', 'add_notification_count_to_menu', 10, 4);

    and

    <?php global $w3all_phpbb_unotifications; if (!empty($w3all_phpbb_unotifications) && $w3all_phpbb_unotifications > 0){ echo'<span class="bildirimvarnokta"></span>'; } ?>

    It’s working! Do you think everything is ok with the codes?

    Plugin Author axew3

    (@axewww)

    Great should be fine!

    And should be enough

    if (!empty($w3all_phpbb_unotifications)){ ....

    in any case, it alone, return the correct result. The code inside will execute only if not empty, so if not 0 or not false or not null. Should be ok!

    • This reply was modified 2 years, 1 month ago by axew3.
    • This reply was modified 2 years, 1 month ago by axew3.
    Thread Starter Halil ESEN

    (@halilesen)

    Thank you!

Viewing 3 replies - 16 through 18 (of 18 total)
  • The topic ‘w3all_phpbb_unotifications doesn’t work’ is closed to new replies.