<?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>pro-web.at &#187; Facebook Connect</title>
	<atom:link href="http://pro-web.at/archives/tag/facebook-connect/feed" rel="self" type="application/rss+xml" />
	<link>http://pro-web.at</link>
	<description></description>
	<lastBuildDate>Sat, 06 Mar 2010 13:40:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Facebook Connect: Display login button only when not connected to site</title>
		<link>http://pro-web.at/archives/facebook-connect-display-login-button-only-when-not-connected-to-site</link>
		<comments>http://pro-web.at/archives/facebook-connect-display-login-button-only-when-not-connected-to-site#comments</comments>
		<pubDate>Wed, 23 Dec 2009 09:41:12 +0000</pubDate>
		<dc:creator>Daniel Prieler</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[Facebook Connect]]></category>

		<guid isPermaLink="false">http://pro-web.at/?p=163</guid>
		<description><![CDATA[Currently i&#8217;m testing the features of Facebook Connect and i ran into troubles:

how to display the login button only if a user has not connected
how to display the image only if a user has connected

My simplest solution was to add some custom css classes:

fb-connecting: when the status of facebook connect is not known. e.g. display [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Currently i&#8217;m testing the features of Facebook Connect and i ran into troubles:</p>
<ul>
<li>how to display the login button only if a user has not connected</li>
<li>how to display the image only if a user has connected</li>
</ul>
<p>My simplest solution was to add some custom css classes:</p>
<ul>
<li>fb-connecting: when the status of facebook connect is not known. e.g. display a &#8220;connecting&#8230;&#8221; message </li>
<li>fb-not-connected: when user is not connected to facebook. e.g. show connect button</li>
<li>fb-connected: when user is connected to facebook. e.g. show user picture and name</li>
</ul>
<p><a href="/blog-content/facebook-connect/">View the demo page</a></p>
<p><span id="more-163"></span></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #00bbdd;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span> xmlns<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span> xmlns:fb<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.facebook.com/2008/fbml&quot;</span>&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
&nbsp;
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_GB&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
&nbsp;
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span>
  $(function() {
    FB_RequireFeatures([&quot;XFBML&quot;], function() {
      FB.Facebook.init(&quot;[[[INSERT APP ID HERE]]]&quot;, &quot;/xd_receiver.htm&quot;);
      FB.Connect.ifUserConnected(function(){
        $('body').addClass('fb-is-connected').removeClass('fb-is-not-connected');
      }, function(){
        $('body').removeClass('fb-is-connected').addClass('fb-is-not-connected');
      });
    });
  });
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
&nbsp;
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">style</span>&gt;</span>
  .fb-connected, .fb-not-connected {
    display: none;
  }
  .fb-is-connected .fb-connecting, .fb-is-not-connected .fb-connecting {
    display: none;
  }
  .fb-is-connected .fb-connected {
    display: block;
  }
  .fb-is-not-connected .fb-not-connected {
    display: block;
  }
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">style</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- fb-connecting: display while facebook is connecting --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;fb-connecting&quot;</span>&gt;</span>Connecting to Facebook<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- fb-not-connected: display when user is not connected to facebook --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;fb-not-connected&quot;</span>&gt;</span>
  <span style="color: #009900;">&lt;fb:login-button v<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;2&quot;</span> <span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;medium&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span>fb:login-button&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- fb-connected #1: display when user is connected to facebook --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;fb-connected&quot;</span>&gt;</span>
  <span style="color: #009900;">&lt;fb:profile-pic uid<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;loggedinuser&quot;</span> <span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;square&quot;</span> facebook-logo<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;true&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span>fb:profile-pic&gt;</span>
  <span style="color: #009900;">&lt;fb:<span style="color: #000066;">name</span> uid<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;loggedinuser&quot;</span> useyou<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;false&quot;</span> linked<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;true&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span>fb:name&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- fb-connected #2: actually, you can add the class to the xfbml-tags and do not need a sourrounding div-tag --&gt;</span>
<span style="color: #009900;">&lt;fb:<span style="color: #000066;">name</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;fb-connected&quot;</span> uid<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;loggedinuser&quot;</span> useyou<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;false&quot;</span> linked<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;true&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span>fb:name&gt;</span></pre></div></div>



<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://pro-web.at/archives/facebook-connect-display-login-button-only-when-not-connected-to-site/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

