Script increasing user uptime-limit - foreach loop problem

Hi
I have a problem with the script increasing user uptime-limit currently logged in, skript don’t work with foreach loop for users in ip> hotspot> user.
When I remove the loop and replace “counter” the username it works fine, but I would like to do automatically. I don’t know what wrong with this loop. Please help.
#get user uptime
:local upt
#get user limit-uptime
:local lupt

limit-uptime - uptime

:local roznica
#set new user uptime
:local nupt
:local counter

:foreach counter in=[/ip hotspot user find ] do={
:set upt [/ip hotspot user get $counter uptime]
:set lupt [/ip hotspot user get $counter limit-uptime]
:set roznica ($lupt-$upt)
:if ($roznica < 5) do={
:set nupt ($upt + 15m)
/ip hotspot user set limit-uptime=$nupt [/ip hotspot user find where name =$counter]
}}

My second idea was add this script to hotspot user-profiles on login scripts, but I do not know how to retrieve the name of currently logged on username.

just replace “local” with “global”
and it will works fine

I try this script, it works to add the uptime limit. But on the user or client does not follow the change. Is there any command to refresh the uptime status without logging out by the user? TIA