s2Member and Facebook – Issue when pages are restricted
I actually enjoy all the amazing possibilities of s2Member and Buddypress combined but I’m really concerned by a “bug” (if it’s a bug) I came across recently.
Since I want my posts to be readable by members only, I protected every one of them by a Level #0 requirement (free registration). Nevertheless, now when I want to “Share on Facebook”, the excerpt and thumbnail displayed are those of the Membership Options Page (the page where you are redirected if you are not logged in).
Is there any way I can keep the old behavior of the Facebook share? I don’t want people to share the Membership Options Page… and that’s not what users want either. The Facebook activity should engage users to have a look on what is the post about.
Thank you a lot for your time and help!
Facebook share cannot see behind a protected page and for good reason. You will need to use a like button instead for sending content to Facebook. The share is being deprecated anyways, it’s only still available because so many sites still use it but the preferred method is the like button.
First of all thank you for your fast answer. I read about pros and cons about both Share and Like button and even if I find the Share button useful I’ll most likely have to get rid of it.
I just tried to “Like” one of my post and see what was going on and Facebook and the same behavior happens. “XYZ liked a link” whereas the link is the link to the Membership Options Page (aswell as the thumbnail and excerpt).
How can I keep my posts restricted to members-only and have the Like or Share buttons (or both) act as they should?
I abandoned this idea because I can’t waste too much time on that.
As I really need the content of the post to be restricted to members only I decided to use API Scripting.
It’s a little more time consuming (and now I need to go through all my posts to add the script), but definitely worth the effort.
PROS : Both share and like works, no additional code necessary.
CONS : More time consuming.
Method : Here is how I start my posts to block post content to logged in users only (regardless to level)…
You must login to read this post and access download link
Hope that helps a couple of peoples out there!
It would be a lot less time-consuming if you were to add the s2member snippet directly in your templates rather than each post as you write them. This way, the code would automatically run on every post.
There are different methods for the like button and you can tell it what link to use. The cut and paste like code scrapes the page so it will read your logged out page. Read about it in Facebook docs.
Thank you for the suggestion. Indeed I think it is the best solution. However I’m not really at ease when I need to play in Php. Can you give me an example of what would look like such an implementation?
Here is the code I found in Page.php (which I think is the file that need to be modified) :
Pages: ‘, ‘after’ => ‘
‘, ‘next_or_number’ => ‘number’)); ?>
Can you point me out where and how to integrate s2Member snippet?
I use a plugin for the like button to show up automatically. I’ve read a couple of things on Facebook developers but for now it seems to me that it’d be a lot of trouble to modify the plugin to act like I want. I will have to do it sooner or later as I think it’s important to have the Facebook thing well set up, but since I plan to open my website on November 1st I need to find solutions that are within my skills.
Thank you both for your time and help!
- The topic ‘s2Member and Facebook – Issue when pages are restricted’ is closed to new replies.