Buddypress has several methods to get the user ids. This post attempts to clarify the differences between these:
- bp_current_user_id – Exactly the same as bp_displayed_user_id. This is possibly an old, now renamed, method.
- bp_loggedin_user_id – The buddypress logged in user id.
- bp_displayed_user_id – this will return the user id of the user that you are looking at on a page, like someone else’s user profile.
- current_user_id – This is the wordpress user id.