• Resolved Halil

    (@halilesen)


    I see this a lot.

    [12-Jan-2026 17:38:45 UTC] PHP Warning: Attempt to read property “user_unread_privmsg” on string in /home/……

    The code I’m using is this:

    <?php global $w3all_phpbb_usession; if ($w3all_phpbb_usession->user_unread_privmsg > 0) { echo '<span class="ccccccc' . ($w3all_phpbb_usession->user_unread_privmsg > 9 ? ' ttttttt' : '') . ($w3all_phpbb_usession->user_unread_privmsg > 99 ? ' ttttt' : '') . '">' . $w3all_phpbb_usession->user_unread_privmsg . '</span>'; } ?>

    The goal is to show logged-in users the number of PM notifications. The code works, but I’m not sure why I’m seeing error lines in the error_log.

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author axew3

    (@axewww)

    Hello, i did not tested this by long time, anyway, before i attempt to,

    where/how you are using this?

    into a widget or template file or where?

    Plugin Author axew3

    (@axewww)

    Tested it.

    Into file, for example

    /wp-content/plugins/wp-w3all-phpbb-integration/common/apps/phpbb_last_topics/render.php

    having the widget last topics active, so adding on it your code simplified like this

    <?php global $w3all_phpbb_usession; 
    //print_r($w3all_phpbb_usession);//exit;
    if ($w3all_phpbb_usession->user_unread_privmsg > 0) {
    $a = $w3all_phpbb_usession->user_unread_privmsg > 9 ? ' ttttttt' : '';
    $b = $w3all_phpbb_usession->user_unread_privmsg > 99 ? ' ttttt' : '';
    echo '<span class="ccccccc">' . $a . $b. $w3all_phpbb_usession->user_unread_privmsg . '</span>'; } ?>

    It work fine BUT

    NOT FOR THE USER WP ID 1 OR phpBB USER ID 2

    because the UID 1 is excluded and his session is never existent, the var

    $w3all_phpbb_usession

    return always an empty string as value! So maybe it is the problem?

    PS good point to be notified into the explain page

    • This reply was modified 2 months, 2 weeks ago by axew3.
    • This reply was modified 2 months, 2 weeks ago by axew3.
    Thread Starter Halil

    (@halilesen)

    Yes, I think the problem is the admin ID.

    I plan to disable the admin later and use my other account, so I will be testing more later.

    Could a match like 1 = 2 be made for w3all_phpbb_usession?

    Plugin Author axew3

    (@axewww)

    Yes! But there are many points where the UID 1 in WP or the phpBB UID 2 are switched. It can be done easily since the integration is by email, and could be cleaned on next version but is it really useful?

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.