The function below is causing a php notice.
[02-Dec-2020 05:04:20 UTC] PHP Notice: Trying to get property \'roles\' of non-object in functions.php
if