At the moment, using the requests dialogue I can get a multi-friend selector come up when I want the user to invite their friends to my application (that's when the "to" parameter isn't defined). On Chrome / Safari - this is a new window, but is there any way of having all of the users friends already selected?
Otherwise - is there a way to put together a request / invite to all of the users friends? I've tried getting an array of all the user's friends id's into the "to" parameter, but that gives an error on FB.
I've seen a few applications on facebook that do make it possible for the user to "select all" or "invite all" of their friends - http://blog.fbsocialapps.com/2011/10/5-ways-to-tune-your-requests-to-improve-the-virality-of-your-facebook-application/
Edit - As mentioned in the comments, I'm doing this on RoR using the omniauth gem + JS SDK. I was hoping that someone may have come across this problem, and can share a solution. My intentions are not to spam, but make it easier for the user to share the application if it's worth sharing.
Basically what the apps mentioned on the site you posted are doing is to use a custom friend selector (See also: Requests Pro-Tips, Pro-Tip 2: Create a Custom Multi-Friend Selector).
This is pretty easy and straight-forward – read the list of the users friends, generate the kind of HTML you’d like them to be displayed with (a Form, an UL, IMG elements with the friends profile picture, Checkboxes to select friends, …). If you don’t want to use the JS SDK, you can do that (reading friends list + generate the HTML) server-side as well in your RoR app.
Only the part where the user can select all friends at once is probably best done client-side – loop through all the HTML elements representing the listed friends, and check the checkboxes via script. Pretty easy if you are for example using jQuery or something.
(Of course this could also be done by just having a checkbox labeled “send request to all friends”, and see if this is checked server-side and then send request to all friends – but that would not provide direct feedback that all friends are selected now to the user on the page.)
Then you could just send the form with all/some friends marked in it to your server-side app, generate the URL for the request dialog there and put the friend’s ids into the toparameter, and redirect the user’s browser to it.
Related
I have an app that posts a message to a person's Facebook Timeline / wall.
Is there a way to disable commenting or likes on that post via the Graph API?
No that's not possible with graph api!
You can only disable commenting for a post if the end user is a 'page' or public profile, but not if posting to a normal user.
No - whether or not a post can be liked or commented on is determined by the privacy settings of the user who posted the content - for example, you may not be able to comment on posts in a Group, even if the posts are visible to you, because the Group admin has selected to only allow members to interact with content there.
Similar restrictions are in place for user profiles (allowing comments on content posted to a user's timeline) and pages (e.g. only fans of the page can comment).
There is no way to make a post and have an option or parameter on that specific post which prevents Likes, comments, sharing, etc for that content.
I'm building a music website on Symfony 1.4 and Doctrine 1.2. I'm trying to integrate facebook plugins (like, send, post a message buttons) on my pages. For example, I want users to be able to like a song on a song page in my song module. But the problem is, I've used sfDoctrineGuard to secure all modules on my app except for the landing page. So if a user logs in and uses the facebook like button to like a song on the song page, because that song module is secured by sfGuardAuth, facebook API can't talk to it and gets forwarded to the landing page. This means that all likes on my app get posted on facebook activity feed as if the user liked my landing page.
Is there a way to build an exception into sfGuard so that any traffic coming from facebook domain can access that page? Is there a workaround to this? I want to be able to show all the facebook meta data from my secured pages, for whichever song is liked, on a facebook wall. If I disable all sfGuard security, it works fine.
Any help would be great as I'm stumped and haven't found any one else with this problem.
Well, it could be a huge security hole if you want to allow request from Facebook to be able to by pass your sfGuard security. If someone click that link on Facebook, it will also have access to your website without having to be logged in.
You might find a work around by tweaking the Facebook bot who scrape your page. The user agent of the scraper is: "facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)". So it could be easy to allow access to its request by looking at the user agent. BUT, any one can spoof a user agent easily today.
Maybe you have to find an other way. I though about a kind of light page wich can be accessible for every one and where you display the minimum information (like only the artist and the song name without being able to play it. But just to be sure that, if someone not logged in try to see the page, it won't be redirect to the login page but to this light page. You get the point?
Then, you can put a huge button to allow new people to register to see the full page.
Anyway, in any case you will find, you should implement it using filter (in filters.yml). Filters are executed before any action. So it's the perfect place for this kind of check.
You will find info about filters:
on the official website (they are 2 links)
here an implementation of a ssl requirement (sorry a googlecache page)
here a basic implementation
edit:
I will go on sth like that. First, create a user called "facebook bot", and put its id in the /apps/frontend/config/app.yml:
all:
facebook_bot_id: 56 // sf_guard_user_id
Then create a simple filter lib/filter/facebookBotFilter.php
<?php
class facebookBotFilter extends sfFilter
{
public function execute ($filterChain)
{
$context = $this->getContext();
$controller = $context->getController();
$request = $context->getRequest();
$user = $context->getUser();
// get the user agent
$pathArray = $request->getPathInfoArray();
$useragent = isset($pathArray['HTTP_USER_AGENT']) ? $pathArray['HTTP_USER_AGENT'] : '';
if (preg_math('/facebookexternalhit', $useragent))
{
$member = Doctrine_Core::getTable('sfGuardUser')->find(sfConfig::get('app_facebook_bot_id'));
// logged in the facebook bot
$user->signIn($member);
}
// execute next filter
$filterChain->execute();
}
}
Don't forget to enabled the filter in apps/frontend/config/filters.yml:
rendering: ~
facebookBotFilter:
class: facebookBotFilter
security: ~
I'm developing a personal project in which many users join a certain project and are able to view the information on it. Besides that, I'd like to be able that a user could tweet to the other users, warning he is online.
E.g.: user1, user2 and user3 share a project. If user1 is online, but user2 and user3 aren't, user1 would then click a button that would send a tweet (e.g., "#user2twitteraccount User1 is online!") to user2 and user3. The tweet sender would be an account of the website, not user1's Twitter account.
Is that possible to be done? 'Cause, from what I've seen so far, there are two options that are mainly used:
1) The "share button" option (Requires authentication): there is a share button, which sends a tweet on the user's timeline. It prompts a screen so the user can write whatever he want to tweet.
2) The "authorization-required" option (Requires authentication and application authorization): an application tweets on behalf of the user on his timeline.
Besides the things that I have stated, the main thing that bothers me about these options is that they tweet on behalf of the user on his account. As I am looking for a solution on which, instead of using the user's Twitter, the user would tweet throughout my site's Twitter, they doesn't work for me.
Am I missing to see something quite obvious in here, or what I want to achieve isn't quite usual? Do you know any ways that I could achieve this solution? Thanks.
I believe your best bet would be to use the Twitter web intents
You could then tweet to #user2 and #user3 from the account of #user1 adding a via #appname to the tweet text.
NOTE: #appname should be the twitter account of your app.
If this is unsatisfactory, then you should do what sarnold says as that would be the best option
(Only suggested the intents thing because you want to avoid requesting authorization)
You'll want to use the REST API.
Register your application and then POST tweets as you want to send new messages.
I am a newbie with facebook applications.
Ok. I should create a fanpage. This should connect to my Rails application.
So If user is a fan I should show "fan page 1", else i should show "fan page 2".
How could ask permissions on facebook fan page?
Thanks in advance and excuse if you don´t understand my question.
You have a couple of options.
The easy one is to use on of the FB apps like Static HTML Tab that lets you put in some HTML (usually an iframe) for the fan, and another for the non fan. Here ar some of the apps:
Static HTML App
http://www.facebook.com/apps/application.php?id=190322544333196
Or a round up (some paid)
http://www.socialmediaexaminer.com/top-10-facebook-apps-for-building-custom-pages-tabs/
Then your second option is to develop it your self. It is not that hard.
In your App Settings there is a field fot your TAB URL. Point that to a file you would like to use as a tab somewhere in the directory of your app. in PHP you_domain.com/app/tab.php
When Facebook loads that URL in a tab it will pass it a signed request that contains basic information about the user Liker or not, Locale etc.
You can extract that data and depending on that information show one piece of content or the other.
Here is a post on how toparse the signed request with rails:
http://qugstart.com/blog/ruby-and-rails/facebook-base64-url-decode-for-signed_request/
I have a signup form, and I wanted to make it so that they have the option of recommending this signup to all their friends in facebook.
Is there a rails API/gem for doing this?
Is there an appropriate name for this?
Thanks!
Looking at the Extended permissions documentation, you don't get access to the email addresses of a Facebook user's friends (search for email and note the second column reads not available). If that's what you're trying to achieve, it's almost certainly not possible, without the user contacting each friend and asking them to visit your app (which I would imagine would have quite a low take-up, if only through inertia).
I guess you have two options:
popup a javascript before submitting the form to prompt the user wether he wants to share it with friends. You will use the js api http://github.com/facebook/connect-js (see the dialog section). This solution would avoid doing server side connection to the facebook api
Have a look a the Facebooker gem to do a stream_publish