Talk:Tabbed Profile

From Facebook Developer Wiki

Jump to: navigation, search

How do you remove application tabs?!

Click the tab to select it. You'll see a pencil icon on the right side of the tab. Click that and choose Delete Tab.

How to get the profile_setFBML data on Profile Tab URL page ?

Contents

[edit] Relative links

The document states:

Relative URLs are treated as if they are relative to your home canvas page and AJAX-loads in the tab.

However, my tab is resolving a relative link for friends.jsp as http://www.facebook.com/friends.jsp

I guess I'll fix this by using absolute URLs, but it sounds like the documentation doesn't match the actual behaviour here if I've understood correctly?

Is there any way you guys could make it to where the info tab could be moved in front on the wall tab for both friends and non-friends?

[edit] Advertising on Tabs?

I'll probably be able to dig it out somewhere, but it would have been nice if this page stated if one can or cannot put advertising on "Tab" pages.

I'm pretty sure it's "no" on the profile/boxes, right?

Hi Richard, in the section here about Application Tab Behavior is this bullet point: "Application tabs cannot contain advertising of any kind." I'll give the section a once over to see if I can make things clearer. Thanks, Pete (563683308 13:59, 11 February 2009 (PST))

[edit] Add a new tab menu does not show my application

I have configured the application to provide an application tab. On the application settings from a user perspective (accessible through Settings menu on the top bar when user is using the application), it says 'Tab: available (add)'. But from the user profile the '+' sign next to other tabs does not offer to add my application. Why is this? Also, some users will be able to add the tab using the (add) link mentioned above, but I (using my user) click the same link and the tab will not appear on my profile, others cannot see it either. What am I doing wrong? --1557560908 11:44, 4 June 2009 (PDT)

FYI: Same problem here, I can add tabs to other applications but not to my user

[edit] Tab URL incorrectly concatenates two files in URL

Hi, If I point my application to http://my.url.com/application.php, it works fine. But then if I specify my tab URL as tab.php, facebook incorrectly requests http://my.url.com/application.phptab.php and displays a blank page. I had to make a directory, http://my.url.com/application/ , move my application.php file to application/index.php, and put my tab.php file in the application directory. I also had to re-point my application settings to http://my.url.com/application/ for this to work. To the user above, this may be what's happening to you. - Jordan

Jordan, what you're seeing will happen for any other page, not just a tab. If you're using PHP pages, you should either append a ? after the canvas page name, in which case any other pages in the same directory as the canvas page will get appended to the canvas page URL. Or, you could put the files in a separate directory, as you discovered. I'll add information about this to the docs. Sorry for the lack of clarity. Pete (563683308 17:07, 11 June 2009 (PDT))

[edit] Update Content

How about just letting a single function be called - one that updates an element with content from a page via an Ajax request? Something like fillFromPage("[elementid]", "[pageurl]"); If the page is doing any processing at all the leeway before a timeout is almost nil, so the only real way to have a processing intensive page (for example, a page that goes through friends looking for app users or something) is to update via Ajax. Without this function being allowed the only solution is to prompt the user to get the required interaction before code execution. That could just make tabs annoying if a lot of apps load the tab partially and then require a click to complete.

[edit] Incorrect Information!!

I just removed a bullet point listed under "Application Tab Behavior and Policies" that said the following:

"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_profile_user parameter, but that user's session key is not."


You're correct, the fb_sig_profile_user parameter is the profile owner's user ID, and not the viewer's. The viewer's UID is passed as fb_sig_user once the user interacts with the tab. I clarified the bullet points in the article. Sorry for the confusion. Pete -- 563683308 14:17, 29 October 2009 (PDT)

I just spent the last hour testing this, and it is in fact 100% FALSE! For proof, refer to the test app I put up at http://apps.facebook.com/sochatfb. Add the tab for it to your profile, then try clicking the test link and submit the test form. The first takes you to another page (a relative URL that loads on the tab), which displays a print_r() of the $_POST data. As you can see, it's still sending the PROFILE OWNER's userid, not the viewing user's ID. The second example, the form button, for some reason just redirects you back to whatever profile you're logged-in as (even though I have the target set to the same page as the link; does this regardless of get/post method). That part is probably something I missed on my end, but nevertheless. When I first tried it though it did go to the correct page, only to have the exact same behavior as the link-- completely contrary to what's quoted above.

So, I've verified through testing that the quote above is completely FALSE. If you submit a form or click a relative URL that loads on the same tab, it does not pass "that user's UID.... as the fb_sig_profile_user parameter." I know, because I wasted an hour of my time thanks to that entry!

I'm assuming this is simply outdated. Nevertheless, it is incorrect, and I don't want anybody else to be duped because of that as I have. If you believe I'm somehow mistaken, please post a response here first. I saw somebody else recently tried to remove this erroneous entry as well, but his change was reverted with an explanation that seemed to have nothing to do with his edit. So please, for the sake of clarity, RESPOND HERE FIRST! Otherwise, you're probably just gonna have to keep dealing with people making the same change as they discover that the statement is in fact completely inaccurate. 686687569 21:24, 28 October 2009 (PDT)


I spent another few hours toying with this, and I eventually managed to come up with a way to get a *different* variable to pass the viewing user's ID, though it's still very different than what the snippet I removed described.

In point of fact, the fb_sig_profile_user parameter *always* passes the profile owner's userid, regardless of the circumstances. However, if you do some very specific crap with a form and a div tag, you can make it pass the viewing user's ID via the fb_sig_user parameter.

For this to work, you need the form's submit button to be formatted as such:

<input type="button" clickrewriteurl="<your script URL>" clickrewriteform="<your form ID>" clickrewriteid="<your div ID>" id="submitform" value="Submit Text Goes Here" />


You'll also need to create a DIV tag, with a name/ID set to whatever you specified for clickrewriteid. You can put whatever you want in that div, or nothing at all. You can even put the form itself in there. Just remember that whatever you have in the div will disappear and be replaced (see below).

Now, you'll need the following PHP code in the same script (this is just an example of course):

<?php

if ( isset( $_POST["submitform"] ) ) { ?> The profile is owned by <fb:name uid="<?php print $_POST["profuser"]; ?>"></fb:name> (<?php print $profuser; ?>).



Your name is <fb:name uid="<?php print $_POST["fb_sig_user"]; ?>" useyou="false"></fb:name> (<?php print $_POST["fb_sig_user"]; ?>).

<?php

die(); }


Note that, for the optional "profuser" variable to work, you'll need to add the following element to your form since this variable will otherwise be lost:

<input type="hidden" name="profuser" id="profuser" value="<?php print $_POST["fb_sig_profile_user"]; ?>" />


  • IF* you take these very specific steps, the contents of your div will be replaced by whatever's printed out in that PHP code, including the viewing user.

Perhaps we can change the artice to explain this? Because the original wording is inaccurate and only leads to confusion. 686687569 23:29, 28 October 2009 (PDT)

[edit] Getting at fb_sig_profile_user parameter?

Thanks for the write up, but how do I access the fb_sig_profile_user parameter in my php code? I searched around and found an example where it is passed in the $_SESSION variable but when I try to access that variable on my page it is showing up as empty.

reference