Using a custom field value as current users name [closed]

First of all, you’re testing for a string, as you’re wrapping the_field("my_field") in single quotes. So, you want to remove these quotes. Next, the_field("my_field") outputs a field, it doesn’t return it. You should try get_field instead of the_field.