You are asking about WP functions on a support forum for BP
What are you actually trying to do? There may be BP method.
The function is failing as you likely haven’t called the global variable $current_user or get_currentuserinfo#()
but you should read the WP codex on how to access this data.
All the info you need is in the codex pages:
http://codex.wordpress.org/Function_Reference/wp_get_current_user