I'm writing a hook that makes use of a logged in user's UID. I tried using Member::getUID()
, but the script just stops at that line. I tried Member::get('_uid')
, same result.
I edited the method to:
public function get($key, $default=null)
{
// manage special exceptions
if ($key == 'name' || $key == 'username') {
// name is a separate field
return $this->username;
} elseif ($key == 'password') {
// we only ever return the password_hash
$key = 'password_hash';
}
dd(array_get($this->data, $key, $default));
return array_get($this->data, $key, $default);
}
…and it dumped the expected value. I tried setting array_get()
's output to a var and returning the var, no dice. I tried hardcoding the expected result (return 'my-UID';
), but that didn't work either.
I can't get this function to return anything, so I'm stepping away before I punch a hole through my screen.
EDIT:
I'm on Statamic 1.10.4. I also tried 1.10.3, re-installing Statamic, and using an entirely separate installation.