Get the USER_ID of the currently displayed user. This buddypress function returns user_ID of profile page which is being visited. This also means that you can simply know if you are on a profile page by checking if the bp_displayed_user_id()
function is not empty.
bp_displayed_user_id()
None.
(INT) The currently displayed profile’s user_ID. Otherwise 0
This function can also be used to determine, if you are currently on profile page or not. So if you are not on profile page , 0(int) will be returned by the function.