1. You're using the identifier format for getuser but the dollar is missing, so the code is setting %here_before to the literal string "getUser($chan,$nick)" without the channel and nick being evaluated.

Since that variable is never going to be the numeral 1, it always branches here, where it tries to execute the literal alias "setUser($chan,$nick,1)" which doesn't exist.

2. As for your manual command, without 2 forward-slashes it types into channel that literal text.

It also types the text beginning with /w into channel instead of executing the /w alias, which you've never shown us whether it's a /notice or what it does. If you precede with 2 forward slashes but type that in status window, $chan is $null, and it tries to send a message to a nick named /w.