*

Tango

  • ***
  • 85 posts
Notice when showing the user IP
« 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!

*

MB Themes

Re: Notice when showing the user IP
« Reply #1 on: October 07, 2021, 04:16:58 PM »
In some cases variable from_user is not defined
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Tango

  • ***
  • 85 posts
Re: Notice when showing the user IP
« Reply #2 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...

*

MB Themes

Re: Notice when showing the user IP
« Reply #3 on: October 07, 2021, 08:25:42 PM »
Easiest (not best) is to place @ at start.
Your ussage of isset is wrong & wrong  ::)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots