Junal on the run

How Profile Box Works in New Facebook

Posted on: October 13, 2008

Lots of things have changed in new Facebook and these changes brought nightmare for developers, especially for existing applications. Old news feed will be deprecated very soon, and all existing apps should use the new news feeds method. Another one is Profile box, in old method it was default but this is no more default in new facebook. Now, users will be asked by an add button to add the profile box. Once users decided to add the profile box they can preview the profile box and clicking on the add button they can add it. So, some extra work for developers no doubt. Let’s see how we can add profile box in new facebook.

I’m taking the example from my personal facebook application Fallywood

First thing, is to add the button that will ask users whether they want to add the profile box or not. For that we have to use 2 FB tags

1.    fb:if-section-not-added  (decide whether user has added the box)
2.    fb:add-section-button    (if not then show the button)

We can add this button in each page of the app or we can add this button in any specific page, depends on us.

<fb :if-section-not-added section="profile">
<div style="height:45px; width:602px;">
<div id="movieCategories" class="box" style= "width:600px;">
<div class="class ">
<div class="class_">
             Add <b>Fallywood</b> to your profile:</div>
<div class="label_2"><fb :add-section-button section="profile"/></div>
</div>
</div>
</div>
</fb>
Add Button

Add Button

But we can set it such a way so that once users added the profile box; div that contains the button doesn’t appear anymore. So put all CSS inside of “fb:if-section-not-added ” Note two things that,
  1. Button will not appear if the user already added the box in his/her profile
  2. And you must setup the “Post-Authorize Redirect URL” to where your profile box method will be called. (i.e. http://apps.facebook.com/your_app_name/profile_box.php)

Now, it’s time to create the profile box, remember we have to create both wide and narrow profile box. And width of narrow profile box never can be more than 184px! If we don’t set this width, narrow profile box will not be appearing. Width of wide profile box should be 380px!

It’s time to call the method…..

// this variable/array should contain all the data for small profile box
$small_profile_fbml  ="I'm Small Profile Box ";
// this variable/array should contain all the data for big profile box
$big_profile_fbml      = "I'm Big Profile Box";
//set the profile box
$facebook->api_client->profile_setFBML(NULL, $fb_user, $big_profile_fbml, '', '', $small_profile_fbml);
Preview the Profile Box

Preview the Profile Box

Set the box in your profile page

Set the box in your profile page

That’s it! It should work now :), please feel free to ask me any question….

About these ads

33 Responses to "How Profile Box Works in New Facebook"

I tried your code but for some reason the preview popup doesn’t show the right content. It shows the content that I set a while back. Is there a way to force facebook to grab the new content set in profile_setfbml?

@Herve: I faced the same problem! try changing the value of “$small_profile_fbml” and “$big_profile_fbml” shown in this example, if this works then set your new content and try it again…

thanks

still no luck, I copied your code precicely, ran it again and it’s just seems like facebook ignores subsequent calls to profile_setFBML

To all those facing an issue with the profile box showing “No content to display” (but working in the Boxes tab), please see

Facebook Profile Box Showing No Content

where the issue is resolved.

Thanks for all the help so far, problem for me I can’t work out for the life of me (and boy have I tried…) how to change “Im Small Profile Box” to display something like an external php page specially designed for the narrow window. I’m a total newb so sorry if that doesn’t make sense….

Hi,

I am having a real hard time getting any information to come up in the profile box on my facebook profile page. I am definitely a new developer and have been working on my very simple application much longer than it should be taking. Is there anyway you could tell me, in really simple terms, what is necessary to add, and where to add it, to make text show up in the profile box?

Thank you soo much for ANY assistance!!

The box just posts the “No content to display”

@Andrea : Please check your email. I have replied regarding this issue. If it shows no content found, that means the value you are passing, not getting there. There might be some problem. Please send me your code. thanks

open the facebookapi_php5_restlib.php file and find function profile_setFBML.
u change code …
function profile_setFBML($markup, $uid = null, $profile=”, $profile_action=”, $mobile_profile=”, $profile_main=”) {
return $this->call_method(‘facebook.profile.setFBML’, array(‘markup’ => $markup,
‘uid’ => $uid,
‘profile’ => $profile,
‘profile_action’ => $profile_action,
‘mobile_profile’ => $mobile_profile,
‘profile_main’ => $profile_main));
}

saved. after, file upload server. :)
fb:add-section-button code working now…
ok…

well said.. thank u.. :)

hi but when i click the button ,it asks for add and when i click add it redirects to facebook site.I need everything to happenin my application in popup. thanks in advance

Sir, im a total newbie to this development, the add to profile button doesnt appear? is there some function call in between

Add My Application to your profile:

thanks in advance, i know its supposed to be a link where in when you click it, a pop up window will show, and then it will go to your profile posting some info about your application.

@Janos: Follow the code i have given here in the example. Don’t forget to add it supposed to work, let me know if if you have anymore questions – Thanks

I finally got it to work but somehow the boxes contain “no content to display”. Thanks a lot for the code! :D

I have another question, how do i place pictures inside the profile box? ” does not work?

i read and understood your code. i am using cakephp btw. thanks again. :D

Hi ,

my application is working fine. Thanks very much for Mustafa

Sweet thanks worked first time

Hi, i try a few time and found out your script is not working…

On the page where you’re displaying the button try adding the setFBML call rather than the post authorize url – worked for me.

The only thing that didn’t work for me is the class=”box” – it didn’t get the style like in the screenshot. I don’t know why but I’ll post back if/when I find out.

How do you add Bumper Stickers to your box?

Every man has a different set of skills and apti- tudes, and every plot of ground has its own unique features, its own distinctive resources. ,

The first story is of a young man trying to go about his business who encounters a force greater than himself:A young man in a certain village in central province is going about his own business, trying to make a living and all of that life consuming stuff. ,

hello,
i am trying to understand it yesterday. i even don’t read so much for a 50 marks university course ;).

how can I put dynamic content here? i tried to put an image there which is dynamic. suppose, online and offline. if user is online, it will show online image otherwise offline image.

i tried something like:
$imgurl = ‘http://facebook.projanmo.com/dynphoto/img.php;

echo ”;

this is not working. img.php decides which image to show with proper mime header. no image is showing. however it shows in app page. just not in profile box.

can you please suggest me a solution?

Hi,

How to come back to application
after profile box added to facebook profile? Is it possible? How to validate whether profile box already added? Please share me if any idea…
Its very big problem for me..
Thank you in advance.

Do you need to know html to use this?

Source Code?

Im Noob.

Thank

Merhaba.
Ben Bir Turk’um.
Size Cok Tesekkur Ederim Fakat Bir Sorunum Var.

No content to display.

This box will not be visible to people who view your profile until this application adds content to it.

Ekledigim Kodlar ;

<?php
// this variable/array should contain all the data for small profile box
$small_profile_fbml ='';
// this variable/array should contain all the data for big profile box
$big_profile_fbml = ”;
//set the profile box
$facebook->api_client->profile_setFBML(NULL, $fb_user, $big_profile_fbml, ”, ”, $small_profile_fbml);
?>

Lütfen Yardim Ediniz.

Does it stil work ??
as it seams FaceBook has removed all the settings related to it..

Hello Dear, are you in fact visiting this website regularly, if so then you will definitely get nice
knowledge.

I’m not that much of a online reader to be honest but your blogs really nice, keep it up!
I’ll go ahead and bookmark your website to come back in the future. Many thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

View Junal Rahman's profile on LinkedIn
Subscribe to me on FriendFeed

Follow Me on Twitter

Archives

My photos

Downtown, Ottawa

Dream

Jasper, AB

Jasper, AB

Banff, AB

Folkfest, Bangladesh Pavilion Saskatoon

Lovely Sky

Stunt bikers on summer festival, Saskatoon

More Photos

Blog Stats

  • 390,584 hits
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: