Hide Content To Non Facebook Fans on Wordpress

Ravingace

Registered Member
Joined
Jan 30, 2009
Messages
68
Reaction score
34
Learnt a lot from here, so my first share!

A while ago I saw a post on hiding content to non fans on your Wordpress blog using a plugin from sociable.es
HTML:
http://www.sociable.es/facebook-wordpress-plugin-3-0/
however myself and most of the people on the thread it seemed couldn't get it to work properly using

Code:
<fb:fbml version="1.1">
Everyone sees.
<fb:visible-to-connection>
Hidden Content HERE
</fb:visible-to-connection>
</fb:fbml>

I tried for days to get it work following the instructions on the thread but had no luck, until I tried something different.

The problem I think is that <fb:visible-to-connection> doesn't work out of facebook (I might be wrong), so to make it work I needed to change the requirements.

Still using the plugin from esociable.es I made it so the posts would only be visible to those were logged in by using the Facebook.

Steps:

1. Install Plugin from sociable.es
HTML:
http://www.sociable.es/facebook-wordpress-plugin-3-0/
2. Set up plugin and application
Code:
http://www.sociable.es/facebook-opengraph-wordpress-plugin-configuration/
3. Add Facebook Connect Widget to Sidebar
4. Install "PHP Exec" plugin (allows php code within the post)
5. On posts you want to hide use the following code:

Code:
<phpcode>
<?php if (is_user_logged_in()) { ?>
Hidden Content
<?php } else { ?>
What non logged in users see
eg. To access  this download, you must be <a href="javascript:FB.login(login_facebook);">logged in with Facebook (click here)</a>. 
<?php } ?>
</phpcode>

Now your post is protected and only users who give permission to your application to log in can see the content and you can set the permissions such as e-mails, friends lists, publish to wall etc...

If you want you can also block all posts with the same code just edit the singlepost.php in your template.

I hope this helps some of you out there. I wasn't able to make bank out of this technique as I suck at FB marketing so if this helps anyone and they fancy helping me out please PM me.
 
Did you ever get this working?

I'd like to make a "3 step" website just like everyone has been doing for fan pages.
 
nice share, thanks given. This thread pulls me back to fb :)
cheers
 
Back
Top