I am getting the error:
Function name must be a string on this code:
$profile_data = $user_data('first_name','last_name','email');
Any ideas why this could be?
While you can use variables as function-names, to do so requires the variable to be a string.
The variable $user_data sounds more like an array, or even possibly an object. If this is true, you will receive the error specified. Per the comment from @Jon, it could also be possible that user_data() is a method and the $ is a typo.
If none-of-the-above helps, please all relevant code, specifically the creation of the $user_data variable (or a var_dump($user_data) output).
$user_data was a variable the syntax would not be even close to legal. So it's not very likely that it is one.function test() { } $var = 'test'; $var(); will work perfectly fine.
$beforeuser_data? With the dollar sign this syntax is calling a variable function.var_dump($user_data);outputs if you place it exactly above that line. A related section in the PHP manual is called Variable Functions and might shed some light, too. What is the function (name?) you wanted to call?var_dumpetc) otherwise it's hard to say what exactly causes the error.