Thanks for all of your assistance Nickolas!
Where exactly should I add those lines? I have tried before the initial if statement, inside the function, and inside the if ($user != false) statement, and they all returned the same results as before.
Thanks!
Thanks Nickolas! This is close, but I am still getting a little weird output. My filename ended up as ppg-trav_-horntest-gmail-com_-test_.png, so it seems that there are some extra ‘_’ and the dots are becoming ‘-‘. Any idea how to fix this?