<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Facebook Cookbook &#187; Junal Rahman</title>
	<atom:link href="http://fbcookbook.ofhas.in/author/junal/feed/" rel="self" type="application/rss+xml" />
	<link>http://fbcookbook.ofhas.in</link>
	<description>thousands of app development recipes</description>
	<lastBuildDate>Sun, 21 Mar 2010 10:38:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>how to show facebook friends status</title>
		<link>http://fbcookbook.ofhas.in/2009/02/13/how-to-show-facebook-friends-status/</link>
		<comments>http://fbcookbook.ofhas.in/2009/02/13/how-to-show-facebook-friends-status/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 19:34:20 +0000</pubDate>
		<dc:creator>Junal Rahman</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[FQL]]></category>
		<category><![CDATA[Status]]></category>

		<guid isPermaLink="false">http://fbcookbook.ofhas.in/?p=241</guid>
		<description><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;"><script type="text/javascript">
<!--
digg_url = 'http://fbcookbook.ofhas.in/2009/02/13/how-to-show-facebook-friends-status/';
digg_bgcolor = '#FFFFFF';
digg_skin = '';
digg_window = '';
digg_title = 'how to show facebook friends status';
digg_bodytext = '';
digg_media = 'news';
digg_topic = '';
//-->
</script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
</div>




facebook status api is still in beta, in one of previous posts hasin showed how to set status of users with their permission. now, let&#8217;s see how we can get our facebook friend&#8217;s status, in next step i will  show a tricky way to get a random person&#8217;s status who is not your facebook [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;"><script type="text/javascript">
<!--
digg_url = 'http://fbcookbook.ofhas.in/2009/02/13/how-to-show-facebook-friends-status/';
digg_bgcolor = '#FFFFFF';
digg_skin = '';
digg_window = '';
digg_title = 'how to show facebook friends status';
digg_bodytext = '';
digg_media = 'news';
digg_topic = '';
//-->
</script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
</div>
<p><script type="text/javascript"><!--
google_ad_client = "pub-3649773907774827";
/* 468x15, created 9/26/09 */
google_ad_slot = "6695465500";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
facebook <a href="http://wiki.developers.facebook.com/index.php/Status.get" target="_blank">status api</a> is still in beta, in one of previous posts <a href="http://fbcookbook.ofhas.in/2009/02/07/facebook-reveals-status-api-how-to-use-it/" target="_blank">hasin showed how to set status</a> of users with their permission. now, let&#8217;s see how we can get our facebook friend&#8217;s status, in next step i will  show a tricky way to get a random person&#8217;s status who is not your facebook friend.</p>
<p>first let&#8217;s see how we can show our friends status. these following lines of code will return us an array</p>
<pre name="code" class="php">

include_once(&quot;config.php&quot;);
//i&#039;m using my own id
$user_status= $facebook-&gt;api_client-&gt;fql_query(&quot;SELECT status FROM user WHERE uid =579152077&quot;);
echo &quot;&lt;pre&gt;&quot;;
print_r($user_status);
echo &quot;&lt;/pre&gt;&quot;;
//this will return an array like following
Array
(
    [0] =&gt; Array
        (
            [status] =&gt; Array
                (
                    [message] =&gt; is testing facebook status api.
                    [time] =&gt; 1234464510
                    [status_id] =&gt; 53699066735
                )

        )

)
</pre>
<p>so we can get any of  our facebook friends&#8217; status like this. If no status messages are found, the method returns an empty <code>status_get_response</code> element. now, the thing is, we can check our friends status from &#8220;live feed&#8221; tab on our home page right? so  this status api could be interesting if we can show random friend&#8217;s status eh? unfortunately, this current beta API doesn&#8217;t support to get any random friends status but for the time being there is a possible way to get status of a person who is not our facebook friends BUT if he/she has at least 1 mutual friend. so let&#8217;s find a least possible way to get a random friend&#8217;s status who is NOT our friend on facebook but has a mutual friend. don&#8217;t worry, you don&#8217;t have to know his or her id <img src='http://fbcookbook.ofhas.in/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  let&#8217;s have a look at following code.</p>
<pre name="code" class="php">

include_once(&quot;config.php&quot;);
//get id by the random person&#039;s full name
$user_details = $facebook-&gt;api_client-&gt;fql_query(&quot;SELECT uid FROM user WHERE name = &#039;your_random_friend_full_name&#039;&quot;);
//if this full name is unique and has a mutual friend with you, you can get his/her id like this...
$user_details[0][&#039;uid&#039;];
//now let&#039;s find out the status of that person
$status_array= $facebook-&gt;api_client-&gt;fql_query(&quot;SELECT status FROM user WHERE uid = {$user_details[0][&#039;uid&#039;]}&quot;);
//now, simply it will return an array with status message like before.
</pre>
<p>I know this is not the right way to get status. i strongly believe facebook should open this status access to random friends with email id or full name &#8211; only then we can expect lot&#8217;s of cool application on facebook based on this status api.<br />
<script type="text/javascript"><!--
google_ad_client = "pub-3649773907774827";
/* 468x15, created 9/26/09 */
google_ad_slot = "6695465500";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://fbcookbook.ofhas.in/2009/02/13/how-to-show-facebook-friends-status/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>how to resize facebook popup dialog box</title>
		<link>http://fbcookbook.ofhas.in/2009/02/06/how-to-resize-facebook-popup-dialog-box/</link>
		<comments>http://fbcookbook.ofhas.in/2009/02/06/how-to-resize-facebook-popup-dialog-box/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 07:09:32 +0000</pubDate>
		<dc:creator>Junal Rahman</dc:creator>
				<category><![CDATA[Application]]></category>
		<category><![CDATA[FBJS]]></category>
		<category><![CDATA[Feed]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Dialog]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[Hack]]></category>

		<guid isPermaLink="false">http://fbcookbook.ofhas.in/?p=121</guid>
		<description><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;"><script type="text/javascript">
<!--
digg_url = 'http://fbcookbook.ofhas.in/2009/02/06/how-to-resize-facebook-popup-dialog-box/';
digg_bgcolor = '#FFFFFF';
digg_skin = '';
digg_window = '';
digg_title = 'how to resize facebook popup dialog box';
digg_bodytext = '';
digg_media = 'news';
digg_topic = '';
//-->
</script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
</div>
while developing facebook applications, sometimes we don&#8217;t like to use the default facebook popup dialog box, we want to resize/modify to show it on our own way. but how can we do it? we don&#8217;t have the css class on our hand right. but don&#8217;t worry, we have this simple trick to make it on [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;"><script type="text/javascript">
<!--
digg_url = 'http://fbcookbook.ofhas.in/2009/02/06/how-to-resize-facebook-popup-dialog-box/';
digg_bgcolor = '#FFFFFF';
digg_skin = '';
digg_window = '';
digg_title = 'how to resize facebook popup dialog box';
digg_bodytext = '';
digg_media = 'news';
digg_topic = '';
//-->
</script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
</div>
<p>while developing facebook applications, sometimes we don&#8217;t like to use the default facebook popup dialog box, we want to resize/modify to show it on our own way. but how can we do it? we don&#8217;t have the css class on our hand right. but don&#8217;t worry, we have this simple trick to make it on our own way.</p>
<p>let&#8217;s see how we can do it&#8230;.</p>
<p>first let&#8217;s see how a default popup box looks like. let&#8217;s print something pretty simple and set a button that will call the javascript function which will create the default popup dialog box. following code will do it for us..</p>
<pre name="code" class="php">
&lt;?php
include_once(&quot;config.php&quot;);
?&gt;
&lt;input type=&quot;button&quot; value=&quot;click me&quot; onclick=&quot; return showMe()&quot;&gt;
&lt;script language=&quot;javascript&quot;&gt;
function showMe()
{
   new Dialog().showMessage(&#039;Hi There&#039;, &#039; Hi, i\&#039;m a default pop-up, but shh you can play with me!&#039; );
}
&lt;/script&gt;
</pre>
<p>and this will generate a popup like the following screen shot.</p>
<div id="attachment_135" class="wp-caption aligncenter" style="width: 310px"><a href="http://fbcookbook.ofhas.in/wp-content/uploads/2009/02/default1.png"><img class="size-medium wp-image-135" title="Default Dialog Box" src="http://fbcookbook.ofhas.in/wp-content/uploads/2009/02/default1-300x79.png" alt="Default Dialog Box" width="300" height="79" /></a><p class="wp-caption-text">Default Dialog Box</p></div>
<p>now, we want to change this default dialog box right. ok, this default dialog box uses some css classes which can be found using firefox add on firebug. one of them is called &#8220;dialog_body&#8221; which contains the body of the dialog box. Idea is to overwrite the css class to make it our own <img src='http://fbcookbook.ofhas.in/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  let&#8217;s change the &#8220;dialog_body&#8221; class in the following way&#8230;</p>
<pre name="code" class="css">

&lt;style&gt;
.dialog_body{
   background-color:#CCCCCC !important;
   font-weight:bold !important;
   font-size:16px;
   text-align:center !important;
   padding-left:0px !important;
   padding-top:10px!important;
   padding-bottom:10px!important;
}
&lt;/style&gt;
</pre>
<p>just set the &#8220;!important&#8221; to get the priority over the existing properties. now let&#8217;s see how out new dialog box looks like ..</p>
<div id="attachment_137" class="wp-caption aligncenter" style="width: 310px"><a href="http://fbcookbook.ofhas.in/wp-content/uploads/2009/02/bg1.png"><img class="size-medium wp-image-137" title="Changed Dialog Box" src="http://fbcookbook.ofhas.in/wp-content/uploads/2009/02/bg1-300x95.png" alt="Changed Dialog Box" width="300" height="95" /></a><p class="wp-caption-text">Changed Dialog Box</p></div>
<p style="text-align: center;">
<p>cool eh?<br />
now, how about make this popup dialog box wider than the default size? well, we have that trick too!<br />
this css class called &#8220;<em>pop_dialog_table</em>&#8220;, which holds the whole dialog box&#8217;s div. so increasing it&#8217;s width will also increase the size of the dialog box. so let&#8217;s do it!</p>
<pre name="code" class="css">

&lt;style&gt;
.pop_dialog_table {
   width: 650px !important;
}
&lt;/style&gt;
</pre>
<p>how this will look like then? have a look at the following screen shot</p>
<div id="attachment_151" class="wp-caption aligncenter" style="width: 310px"><a href="http://fbcookbook.ofhas.in/wp-content/uploads/2009/02/long3.jpeg"><img class="size-medium wp-image-151" title="Wider Dialog Box" src="http://fbcookbook.ofhas.in/wp-content/uploads/2009/02/long3-300x61.jpg" alt="Wider Dialog Box" width="300" height="61" /></a><p class="wp-caption-text">Wider Dialog Box</p></div>
<p>simple eh? hope it helps to play with this popup dialog box on your own way!</p>
]]></content:encoded>
			<wfw:commentRss>http://fbcookbook.ofhas.in/2009/02/06/how-to-resize-facebook-popup-dialog-box/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>how to add profile tab for your facebook application</title>
		<link>http://fbcookbook.ofhas.in/2009/02/04/how-to-add-profile-tab-for-your-facebook-application/</link>
		<comments>http://fbcookbook.ofhas.in/2009/02/04/how-to-add-profile-tab-for-your-facebook-application/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 19:14:24 +0000</pubDate>
		<dc:creator>Junal Rahman</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[Application]]></category>
		<category><![CDATA[FBML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Profile]]></category>

		<guid isPermaLink="false">http://fbcookbook.ofhas.in/?p=77</guid>
		<description><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;"><script type="text/javascript">
<!--
digg_url = 'http://fbcookbook.ofhas.in/2009/02/04/how-to-add-profile-tab-for-your-facebook-application/';
digg_bgcolor = '#FFFFFF';
digg_skin = '';
digg_window = '';
digg_title = 'how to add profile tab for your facebook application';
digg_bodytext = '';
digg_media = 'news';
digg_topic = '';
//-->
</script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
</div>
in new facebook design, users can add an application tab in their profile page along with 4 default tabs Wall, Infos, Photos &#38; Boxes. In this tutorial we will see how we can add profile tab for our facebook application.
so, let&#8217;s go through couple of simple steps that will get this process done.
first of all, [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;"><script type="text/javascript">
<!--
digg_url = 'http://fbcookbook.ofhas.in/2009/02/04/how-to-add-profile-tab-for-your-facebook-application/';
digg_bgcolor = '#FFFFFF';
digg_skin = '';
digg_window = '';
digg_title = 'how to add profile tab for your facebook application';
digg_bodytext = '';
digg_media = 'news';
digg_topic = '';
//-->
</script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
</div>
<p>in new facebook design, users can add an application tab in their profile page along with 4 default tabs Wall, Infos, Photos &amp; Boxes. In this tutorial we will see how we can add profile tab for our facebook application.<br />
so, let&#8217;s go through couple of simple steps that will get this process done.<br />
first of all, let&#8217;s keep something in our mind before we jump into it.</p>
<ul>
<li>an 	application tab is 760 pixels wide. You can make your canvas pages 	as wide as an application tab if you want.</li>
<li>each 	application tab has a label. The labels are text only; a favicon 	cannot appear on the tab label at this time. by default, the tab 	uses the application name as the label</li>
</ul>
<p>now, you have to register an application tab on facebook by specifying a tab URL in your application settings. go to your application settings&gt; Edit Settings, from left nav select &#8220;User Profiles&#8221; &#8211; you there right? In the tab name, give something easy and related to your application name so that user can find it by search. In the second row, you are supposed to see &#8220;Tab URL&#8221;. In the box just enter a name of your page or the location (i.e. <strong>my_tab.php</strong>)</p>
<p>save the change and close the window. now create a new page called &#8220;my_tab.php&#8221;. open the page in your favorite IDE. now, let&#8217;s print something pretty simple to make sure our tab is working fine. you can print anything you want or you can copy &amp; paste the following peace of code  to see something on your tab page.</p>
<pre name="code" class="php">

&lt;?php $user = $_POST[&#039;fb_sig_profile_user&#039;];
?&gt;
hi &lt;fb:name uid=&lt;?=$user;?&gt; linked=&#039;true&#039; size=&#039;normal&#039; useyou=&#039;false&#039; firstnameonly=&#039;false&#039;/&gt;, glad to see your profile tab is working!
</pre>
<p>now, there is a common problem for those who added their profile tab before, they are getting this following message, although it worked before.<br />
&#8220;<em>fb:redirect: redirect forbidden by flavor TabFBMLFlavor on the profile tab.</em>&#8221;<br />
you are facing the same problem? Don t worry at all. Just check if you have this require log in in your profile tab page<br />
i.e.:
<pre name="code" class="php">
  $user = $facebook-&gt;require_login();
</pre>
<p>if so, just remove it and instead that get the user&#8217;s id from &#8220;fb_sig_profile_user&#8221; parameter.<br />
example:</p>
<pre name="code" class="php">
user = $_POST[&#039;fb_sig_profile_user&#039;];
</pre>
<p>so, to avoid this above problem don&#8217;t do the followings&#8230;</p>
<ul>
<li>do 	not use $facebook->require_login() for profile tab views</li>
<li>do 	not use external javascript libraries for profile tab views</li>
</ul>
<p>ok, I believe we are done creating a simple profile tab. Now, let&#8217;s check whether it&#8217;s working or not. go to your profile page and click on the &#8220;+&#8221; sign under your name. If you don&#8217;t see the label of your application then search with the label you gave on your application settings.</p>
<p>you supposed to see the message &#8220;<em>hi, your_name, glad to see your profile tab is working!</em> &#8221; <img src='http://fbcookbook.ofhas.in/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Reference:<br />
http://forum.developers.facebook.com/viewtopic.php?id=23956</p>
]]></content:encoded>
			<wfw:commentRss>http://fbcookbook.ofhas.in/2009/02/04/how-to-add-profile-tab-for-your-facebook-application/feed/</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
	</channel>
</rss>
