Hide Content To Non Facebook Fans on Wordpress

Discussion in 'FaceBook' started by Ravingace, Jun 11, 2010.

  1. Ravingace

    Ravingace Registered Member

    Joined:
    Jan 30, 2009
    Messages:
    68
    Likes Received:
    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.
     
    • Thanks Thanks x 11
  2. davidtl999

    davidtl999 Registered Member

    Joined:
    Nov 2, 2007
    Messages:
    55
    Likes Received:
    9
    Did you ever get this working?

    I'd like to make a "3 step" website just like everyone has been doing for fan pages.
     
  3. Money Man

    Money Man Elite Member

    Joined:
    Apr 2, 2009
    Messages:
    1,777
    Likes Received:
    788
    Gender:
    Male
    Occupation:
    Advertising, marketing, occasional programmer
    Location:
    Internet
    Apparently he did. Did you read his post through and through?
     
  4. Tropics

    Tropics Registered Member

    Joined:
    Jun 10, 2010
    Messages:
    59
    Likes Received:
    5
    tag for later
     
  5. spamgic

    spamgic Junior Member

    Joined:
    Jun 12, 2009
    Messages:
    128
    Likes Received:
    11
    nice share, thanks given. This thread pulls me back to fb :)
    cheers