Osclass Support Forums

Osclass plugin support => User Rating Plugin => Topic started by: Tango on October 07, 2021, 02:19:55 PM

Title: Notice when showing the user IP
Post by: Tango on October 07, 2021, 02:19:55 PM
Hello,

I'm using the following code in rating.php to show the user IP:
Code: [Select]
$user_title .= __('IP', 'user_rating') . ': ' . $from_user['s_access_ip'];
It works fine, however on PHP 7.4, I'm getting the following notices:
Code: [Select]
PHP Notice: Undefined variable: from_user
PHP Notice: Trying to access array offset on value of type null

Any advice on how to fix this?
Thanks!
Title: Re: Notice when showing the user IP
Post by: MB Themes on October 07, 2021, 04:16:58 PM
In some cases variable from_user is not defined
Title: Re: Notice when showing the user IP
Post by: Tango on October 07, 2021, 04:30:33 PM
I tried using isset($from_user['s_access_ip']) and it fixes the notices but returns 1 instead of the actual IP...
Title: Re: Notice when showing the user IP
Post by: MB Themes on October 07, 2021, 08:25:42 PM
Easiest (not best) is to place @ at start.
Your ussage of isset is wrong & wrong  ::)