Page 1 of 1

Facebook "Like" button defaults to Member Option Page

PostPosted: June 7th, 2011, 6:24 am
by johnsamwallace
Is it simply not possible for a logged-in user to "Like" a protected page. Whenever a logged-in user "Likes" a protected page, Facebook grabs the meta for the Member Option Page and posts this to her Facebook timeline. When examining the source code for my page, all of the og meta data is displaying correctly, including the URL to the protected page, yet Facebook posts the Member Option page. Anyone found a solution for this?

Re: Facebook "Like" button defaults to Member Option Page

PostPosted: June 7th, 2011, 12:32 pm
by Cristián Lávaque
Apparently Facebook doesn't just post the data you give it, it wants to actually view the page you're liking. The problem is that to s2Member, Facebook is a visitor without the access required to view the page.

Re: Facebook "Like" button defaults to Member Option Page

PostPosted: June 7th, 2011, 1:19 pm
by johnsamwallace
OK, thank you for answering my question! In that case I need to create an alternate "single" template showing an excerpt that is served up to users who are not logged in. I could us the s2member API to put conditionals into each post but that would be a high-maintenance solution. I could add the conditionals to the single page loop but that would not allow me to control the level of access for each post from the admin panel dialog box. Also considering adding some kind of loop to the member option page template but I'm not quite sure how I'd parse the information to get the desired result. Any suggestions on the best approach to accomplish this. Surely I'm not the only one who is facing this.

Re: Facebook "Like" button defaults to Member Option Page

PostPosted: June 7th, 2011, 2:11 pm
by Cristián Lávaque
Conditionals may be an elegant solution, then those who aren't logged in get the snippet, enough for the Facebook share/like.

Either you edit your posts to use this, or modify each post/page with a WordPress hook based on the user's access permissions. Hmm...

Re: Facebook "Like" button defaults to Member Option Page

PostPosted: June 7th, 2011, 3:01 pm
by johnsamwallace
You're thinking down the same path as I am.

Re: Facebook "Like" button defaults to Member Option Page

PostPosted: June 7th, 2011, 4:55 pm
by mannclann
Being as you guys are talking above my head maybe if you come up with an "elegant" solution and you were willing to share, you would have my undying gratitude.

Thanks

Rick

Re: Facebook "Like" button defaults to Member Option Page

PostPosted: June 13th, 2011, 10:53 pm
by Jason Caldwell
Hmm.. Yea, this is a tough one to deal with.

I have some experience with the Facebook APIs, and I can tell you that Facebook needs to make a full request to the actual page, where it pulls several details. Since the page is protected from public view, it's locked down whenever Facebook attempts to collect those details. I suppose we might be able to allow Facebook to access these pages, perhaps with a configuration area that excludes certain User Agents, as configured by the site owner ( optionally )? Open to feedback on this please. @TODO?

For now, you could do something like this.
Create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
Code: Select all
<?php
add_filter 
("ws_plugin__s2member_is_systematic_use_page", "my_filter");
function my_filter ($is_systematic = FALSE)
    {
        if (stripos ($_SERVER["HTTP_USER_AGENT"], "facebookexternalhit") !== false)
            return true;
        else
            return $is_systematic
;
    }
?>

Re: Facebook "Like" button defaults to Member Option Page

PostPosted: June 14th, 2011, 5:53 am
by johnsamwallace
Thanks for putting this one in your pipe! I'll try the hack.

Re: Facebook "Like" button defaults to Member Option Page

PostPosted: August 12th, 2011, 1:52 pm
by Jwrbloom
Did that work?

Re: Facebook "Like" button defaults to Member Option Page

PostPosted: August 12th, 2011, 4:13 pm
by johnsamwallace
I ended up creating a page template, using the s2member API, that showed excerpts of posts for non-logged-in users. I'm not completely happy with the solution but it's working for now.

Re: Facebook "Like" button defaults to Member Option Page

PostPosted: October 18th, 2011, 5:38 pm
by sijo55
Do we get a fix for this or is there a solution available?

Regards
sijo

Re: Facebook "Like" button defaults to Member Option Page

PostPosted: October 20th, 2011, 5:55 pm
by Jason Caldwell
Thanks for your inquiry.
No, nothing formally added to s2Member's source code in this regard yet. Mainly because this would create a potential security hole in s2Member, since the HTTP_USER_AGENT could be forged by an attacker. Until we find a better way to allow Facebook in, under special circumstances, you'll need to implement something along the lines of what I posted here: viewtopic.php?f=4&t=10070&p=48310#p20646

Re: Facebook "Like" button defaults to Member Option Page

PostPosted: October 21st, 2011, 7:01 am
by sijo55
I have tried this with no luck.
If a user click on the 'Like' button on an article for members, then my Membership Options Page is shown on Facebook as 'Liked', not the actual article page.
I need a fix for this.. please!

Re: Facebook "Like" button defaults to Member Option Page

PostPosted: October 21st, 2011, 8:00 am
by sijo55
I have finally got it to work with some changes to Jason Caldwell code:

Create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
Code: Select all
<?php
add_filter ("ws_plugin__s2member_is_systematic_use_page", "my_filter");
function my_filter ($is_systematic = FALSE)   
{       
//if (stripos ($_SERVER["HTTP_USER_AGENT"], "facebookexternalhit") !== false)           
if (stripos ($_SERVER["HTTP_USER_AGENT"], "facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)") !== false)
return true;       
else           
return $is_systematic;   
}
?>

Re: Facebook "Like" button defaults to Member Option Page

PostPosted: November 25th, 2011, 7:37 am
by XHIBIT
This code is not working for me, theres got to be another way because half of my subscribers I get directly from facebook "like" posts...the rest are from twitter. With this option to reach out to new potential subscribers taken away it defeats the purpose of using this plugin altogether.

Re: Facebook "Like" button defaults to Member Option Page

PostPosted: January 11th, 2012, 3:29 pm
by pettedemon
It doesn't work for me... can we create a user for the plugin ?

Re: Facebook "Like" button defaults to Member Option Page

PostPosted: January 14th, 2012, 9:36 pm
by Jason Caldwell
Thanks for the follow-ups here.
Content protected by s2Member is not available for anyone without proper access to that content, and this includes bots and silent HTTP requests made by 3rd party services such as Facebook. This is not a bug, it's the intended behavior. If your site survives on traffic from Facebook, I would suggest making sure that key areas of your site that need to be indexed by search engines or shared through social networks remain publicly available (i.e. not protected by s2Member). Anything protected by s2Member, is by definition, NOT available publicly.

There have been some attempts made by myself and others in this forum to circumvent this under special circumstances (you'll find code samples for that above). However, please let it be known that none of these would be considered "safe" ways to deal with the issue. The proper way to deal with this (in my opinion) is to make some of your content available publicly, so that it CAN be shared through social networks. Anything else that you make off limits to the public, is not going to work with social network APIs like the Facebook "Like" feature, because that content is available only to "Members" of your site with a Username/Password that authenticates them for access.

Re: Facebook "Like" button defaults to Member Option Page

PostPosted: January 16th, 2012, 1:38 am
by pettedemon
But there isn't not way to create an user to associate to s2Memebers? Facebook is now the best share instrument, the right way is enable it...
Thanks