Skip to Content Skip to Menu

🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

get user id of the current profile page displayed

  • noedesign
  • noedesign
  • OFFLINE
  • Posts: 5
  • Thanks: 0
  • Karma: 0
9 years 9 months ago #260882 by noedesign
Hello,

I'm trying to add a Facebook box to the profile pages.It works good on the profile pages, I get the user id with user_id=$_GET; so I can do my query to get the proper infos.

But this does not work on MY profile page when I am connected, it cannot find the userid so I started to try that CB API ( very hard to find info about the API btw ) with $my_id = $_CB_framework->myId(); but it gives my ID only so on other profile pages, it shows my id and not them.

So my questions are the following :

Why I can't get the user id on my profile page
is there a CB api like $my_id = $_CB_framework->myId(); but more like $my_id = $_CB_framework->idofthecurrentpagedisplayed();
Many another solution to display a Facebook box ( and twitter ) on CB?

Thanks

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48622
  • Thanks: 8303
  • Karma: 1446
9 years 9 months ago #260891 by krileon
The $_CB_framework->myId() API call gets the current viewing users user id. You need the displayed users user id, which is retrieved with $_CB_framework->displayedUser().

Why do you need to do a query with this? If you're storing Facebook or Twitter user id it should be stored to a user field and then you can just substitute it into a Custom HTML field with the social sites plugin HTML. If it's stored in a different table you can query for it using CB Query Field then construct the HTML with a Custom HTML field and substitute in the query field.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • noedesign
  • noedesign
  • OFFLINE
  • Posts: 5
  • Thanks: 0
  • Karma: 0
9 years 9 months ago - 9 years 9 months ago #261260 by noedesign
Hi , thanks for your reply, it did solve my problem :-)

I don't understand when you say 'substitute it into a Custom HTML field" .
Ok I can do a custom html field and put the html I want inside but how do I substitue the id number or email for example in this custom html field ? Without a sql query and php ?

how could I display one field ,let's say the email for example ( which is something I need to retrieve ).What should be the code in the custom html field for that ?
Last edit: 9 years 9 months ago by noedesign.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48622
  • Thanks: 8303
  • Karma: 1446
9 years 9 months ago #261278 by krileon
You can substitute in user field values anywhere that supports substitutions. In this case the Custom HTML field supports them fine. Please see the below tutorial regarding substitution usage information.

www.joomlapolis.com/support/tutorials/107-use-cases/18353-using-substitutions-throughout-cb

As for the user id you can substitute it in with [user_id].


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum