WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to get the viewing profle's (another user's profile that current user is viewing) user_id

is there any shortcode or function available for it?

Thanks in advance.

share|improve this question

closed as off-topic by ialocin, kaiser Aug 4 '14 at 14:31

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

Maybe you need this: bp_displayed_user_id().

Also see playing with the user’s ID in different contexts in BuddyPress documentation.

share|improve this answer
This function is not working for me, I put this into 'functions.php' and always it returning 0. – user1460692 Jul 31 '12 at 6:17
probably the portion of code where you are using it doesn't run when a user profile is displayed; so, it makes sense the return value is 0. For istance, using that function in the homepage or in the member directory or some other page would return 0 for sure. Is this your case? – blake83 Jul 31 '12 at 8:30
hmmm NO, I've added it to function.php, as you may aware it will be executed every time the page refreshes or loads. And the test code I,ve put as below , echo "<script type='text/javascript'>alert(".bp_displayed_user_id().");</script>"; – user1460692 Jul 31 '12 at 9:10
uhm, I was not talking about that...can you paste a portion of the code? Maybe that will help... – blake83 Jul 31 '12 at 9:29
Tha it is the coding part, Its not working, Thank for your time and help @blake83 – user1460692 Jul 31 '12 at 11:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.