views:

548

answers:

4

Hi,

I have created a business page on facebook and added application to a tab.

I want to retrieve the uid of the users who visit the tab. I am using $_POST['fb_sig_profile_user']

But it give the page id not the uid.

Please help me on this.

Thanks

Pankaj

+2  A: 

You cannot get the UID of the user viewing the tab unless they interact with it first:

Application tabs behave like a hybrid of a canvas page and a profile box. A tab has the following properties:

  • It fetches data from its application servers.
  • It can load AJAX.
  • It doesn't know who the viewing user is when the user first visits the tab. Facebook sends the fb_sig_user and fb_sig_profile_user parameters, both containing the profile owner's user ID.
  • If a viewing user interacts with the tab (like submits a form, takes an action that causes an AJAX load of new content, or follows a relative URL that loads on the tab), that user's UID is sent to the application as the fb_sig_user parameter, the profile owner's user ID is sent as the fb_sig_profile_user parameter. The viewing user's session key is key is sent only if the user authorized the application.

(from http://wiki.developers.facebook.com/index.php/Tabbed_Profile#Application%20Tab%20Behavior%20and%20Policies)

Cyphus
That wiki link seems to be dead. I look like Facebook has taken all that down.
Luke
I'd like to know the interaction counts for the instance or forever. As in, if I once interacted with a tab and I come back to it later does it still recognize me as a user or not?
Luke
I wouldn't have thought so - for example (and if I remember correctly) active content such as Flash will only start up when a user interacts with the tab, and this applies each time they visit it. So, I would expect that if you navigate away, then return, you would still have to have the user interact. A word of advice though: Facebook are currently changing the formatting and layout of the application tabs, so things may be changing in the near future.
Cyphus
A: 

This doesn't seem to be 100% true - I have tried this and the fb_sig_user is not populated at all

Richard
A: 

So I can get the users id if he interact with the form..

In my fan page tab I have an AJAX form which the user can submit with some value.. now I need the users id also.. how can I get this..

I tried to get the value in my AJAX submit page using $_POST['fb_sig_user'] with no success.. can anyone help me with this please..

Anz
A: 

Doesn't work with relative URLs :S

Hugo

related questions