Re: Website Comments 1.05 Error - Trying to access array offset on value of type bool

By glennp - February 1, 2024

In response to: https://www.interactivetools.com/forum/forum-posts.php?postNum=2245569#post2245569

Hello,

I resolved the error described in the above thread by following the instructions below however I have a new error.

New error: Warning: Undefined variable $isSubscribed in .../cmsb/plugins/websiteComments/websiteComments.php on line 286

CMSB 3.64, PHP 8.2.15

Thanks!

Glenn

From last thread:

If you locate this block of code in websiteComments.php (around line 275)

function wsc_thread_isSubscribed($tableOrTag, $recordNum) {
  global $CURRENT_USER;

  $isSubscribed = mysql_count('_wsc_subscribers', array(
    'userNum'    => $CURRENT_USER['num'],
    'tableOrTag' => $tableOrTag,
    'recordNum'  => $recordNum,
  ));

  return (bool) $isSubscribed;
}

And replace it with this:

function wsc_thread_isSubscribed($tableOrTag, $recordNum) {
  global $CURRENT_USER;

  if (!empty( $CURRENT_USER )) {
    $isSubscribed = mysql_count('_wsc_subscribers', array(
      'userNum'    => $CURRENT_USER['num'],
      'tableOrTag' => $tableOrTag,
      'recordNum'  => $recordNum,
    ));
  }
  
  return (bool) $isSubscribed;
}

By glennp - February 2, 2024

That worked! Thanks, Dave!

Glenn