Facebook Registration Plugin not Loading - facebook

I'm using the Facebook Registration Plugin and it seems to have stopped working, but I'm not sure why. What happens is that instead of loading the registration form, it just displays the moving bars loading icon (and never loads). I have the necessary credentials, also in the past when my credentials were wrong, an error message would appear in the space that the form would normally show.
One thing I noticed was that when I visit the registration's FB page I can see the two examples without custom fields, but I can't see the example with custom fields. In my usage, I use custom fields. Maybe it has something to do with using custom fields and/or firewalls?
So right now, users can't register. Please help! Thank you!
Here's my code:
<div id="fb-root"></div>
<%= javascript_include_tag "https://connect.facebook.net/en_US/all.js#appId=myappnumberiscorrecthere&xfbml=1" %>
<% site_url = MyApplication::Application.config.site_url %>
<fb:registration
fields="[
{'name':'name'},
{'name':'first_name'},
{'name':'last_name'},
{'name':'email'},
{'name':'gender'},
{'name':'birthday'},
{'name':'username', 'description':'User Name', 'type':'text'},
{'name':'postal_code', 'description':'Postal Code', 'type':'text'},
{'name':'password'},
{'name':'captcha'}
]"
redirect-uri="https://<%= #domain + "." + site_url %>/users"
width="530">
</fb:registration>
</div>

Remove the captcha field.
I'm experiencing the same problem when trying to load their documentation page with custom fields and when using the code you have provided.
By removing the captcha, it seems to work. I presume there is a bug on Facebook's end.

You can track the bug here:
http://developers.facebook.com/bugs/509265599090288?browse=search_5028d48a2f1678298252951

change it from
fields="[
{'name':'name'},
{'name':'first_name'},
{'name':'last_name'},
{'name':'email'},
{'name':'gender'},
{'name':'birthday'},
{'name':'username', 'description':'User Name', 'type':'text'},
{'name':'postal_code', 'description':'Postal Code', 'type':'text'},
{'name':'password'},
{'name':'captcha'}
]"
to
fields=[
{'name':'name'},
{'name':'first_name'},
{'name':'last_name'},
{'name':'email'},
{'name':'gender'},
{'name':'birthday'},
{'name':'username', 'description':'User Name', 'type':'text'},
{'name':'postal_code', 'description':'Postal Code', 'type':'text'},
{'name':'password'},
{'name':'captcha'}
]"

Related

Letting user specify recipients within Feed Dialog

Currently, our app posts to users' friends' walls via Graph API. However, Facebook is deprecating this functionality so we are migrating to the Feed Dialog per Facebook's recommendations (see the February 6, 2013 section at https://developers.facebook.com/roadmap/).
Now, we know we can specify the recipient as part of the Javascript SDK call (note FB.init() is called elsewhere earlier on the page):
<p><a onclick="launchFeedDialog(); return false">Testing the Feed Dialog</a></p>
<script>
function launchFeedDialog() {
// calling the API ...
var obj = {
method: 'feed',
to: 'RECIPIENT NAME', // Can specify recipient here
link: 'http://example.com',
name: 'Test post',
description: 'Test description'
};
FB.ui(obj);
}
</script>
However, it does not seem like the user can modify the recipient in the launched dialog. A screenshot of what I mean is at http://i.imgur.com/oLPTO.png.
Is there some way of invoking the Feed Dialog so that the user can change/add recipients, like in the Send Dialog?
The flow we are trying to implement (and the way it currently is) is:
User clicks a button to launch the Feed dialog
User fills in the Feed dialog (including recipient) and submits
Right now, we are stuck with this awkward flow:
User fills out a custom control specifying the recipient
User clicks a button to launch the Feed dialog
User fills in the Feed dialog and submits
OK, we found a workaround. The general idea:
Display the Feed Dialog inline as an iframe (by specifying display=iframe)
Create your own custom control for selecting a recipient Facebook username or id
Reload the iframe asynchronously upon selecting a recipient or onblur, etc
Some caveats/reasoning for above:
You can't use the JS SDK because it will launch the iframe version of the Feed Dialog as a modal lightbox (rather than inline in your page flow)
You'll need to implement a redirect page that does post processing, such as updating the state of the parent window, logging results, etc
For (2), the custom control can be as simple as a text input field, but you'll probably want at least some sort of autocomplete. This is actually not too tricky, as you grab your user's friend list with the https://graph.facebook.com/me/friends Graph API call.
Here's a basic example using a simple text input:
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
</head>
<body>
<div>
Recipient's FB username:
<input type="text" id="fb-recipient" placeholder="Recipient's FB username"></input>
<input type="submit" id="fb-recipient-submit" value="Pick" />
</div>
<iframe id="fb-feed-dialog" width="586" height="330" frameborder="0" allowfullscreen></iframe>
<script>
$('#fb-recipient-submit').click(function(e){
e.preventDefault();
var feedUrl = 'https://www.facebook.com/dialog/feed?';
feedUrl += 'display=iframe';
feedUrl += '&app_id=' + 'YOUR_APP_ID';
feedUrl += '&access_token=' + 'ACCESS_TOKEN';
feedUrl += '&link=' + 'SHARE_LINK';
feedUrl += '&redirect_uri=' + 'REDIRECT_URI';
feedUrl += '&to=' + $('#fb-recipient').val();
$('#fb-feed-dialog').attr( 'src', feedUrl );
});
</script>
</body>
</html>
You can find a screenshot of a slightly more fleshed out solution at: http://i.imgur.com/0jTM391.png

Passing Parameters from e-mail link to jQuery mobile web app

I created a web app using jquery mobile 1.1.1
As part of my app I built password retrieval functionality. If a user needs to reset their password, they fill out a form and receive an e-mail with a link that includes the address of the password reset page and two other parameters as such:
www.mywebapp.com/demo.html#resetPassword?x=123&y=123
The Initial Problem:
When the user clicks on the link, they see the home page of the web app even though the URL in the address bar says: www.mywebapp.com/demo.html#resetPassword?x=123&y=123 I understand that jQuery mobile does not support passing parameters after the hash, so I came up with the following solution.
A Solution with a small inconvenience:
I put together the following code, which reads the URL, captures my two parameters and redirects the user to the password reset page:
$( document ).bind( "pagebeforeshow", function() {
//cpe("parameter") will check whether the specified URL parameter exists
if(cpe("x") && cpe("y")){
//gpv("parameter") captures the value of the specified URL parameter
recovery.username=gpv("x");
recovery.token=gpv("y");
$.mobile.changePage("#resetPassword");
}
})
The Inconvenience, and thus my current problem:
When the user clicks on the link in the e-mail the browser fires up and opens the main page of the app, and then it quickly displays the #resetPassword page. I understand that this happens because I'm changing the page
$.mobile.changePage("#resetPassword");
But, how do I modify the above code so that the user won't see the main page at all, and go straight to the #resetPassword page?
Use an empty initial page with no content. By default do a changePage to what was your initial page, but in other cases, like the resetPassword case, you changePage to that instead.
I followed Raymond Camden's suggestion and added the following to my html:
<pre>
<!--Start of blank initial page: #initPage-->
<div data-role="page" id="initPage">
<div data-role="content"></div>
</div>
<!-- /page -->
</pre>
I also added the following to my javascript:
//init page -> path control hub
$( document ).bind( "pagebeforeshow", function() {
var pageid=$.mobile.activePage.attr('id');
if(pageid=="initPage"){
if(cpe("x") && cpe("y")){
recovery.username=gpv("x");
recovery.token=gpv("y");
$.mobile.changePage("#resetPassword");
}else{
$.mobile.changePage("#info");
}
}
})
It's working now.

Post a feed with a link without 'shared as link'

I searched for an hour before posting this question so please forgive me in advance if this is a basic, dense question. I feel like there must be something simple I'm not wrapping my head around.
I see many apps, e.g. "WeForPresident" which when joined, post a simple feed. It contains no special formatting, just an image, a link to an external site and some text.
I cannot find a way to do this with the graph api. When I post using the link param, I get 'shared a link' formatting, which is undesired. And yet, using the message param does not allow linking.
So, how are apps such as WeForPresident achieving this effect?
Thanks again.
Bounty Info
Using /TEST_USER_ID/feed with message, link, description, picture, name
Posts as a link
With actions param added
And the application in question the user talks about
Notice no Share mentioned anywhere in the post
Are you talking about something like this?
That's possible through Open Graph Objects and Actions. Here's a brief (and hopefully not terribly confusing) breakdown:
Object: In the image above, the object is "pet who needs a home". An object is text to describe the page you happen to be sharing, and is referenced in the header tags of the page you're sharing (more on that soon.)
Action: In the above image, refers to "shared" in the "... shared a pet who needs a home...". Actions are whatever it is that you're actually doing with open graph. I've seen sites "sign a petition on so-and-so" or "play such-and-such a word on this-and-that app". The bolded words are the action.
Both actions and object types can be defined on http://developers.facebook.com. If / when you have an app, and you opt to use Open Graph, it encourages you to create at least one action and one object type. There are a number of predefined ones ("reading a book", "cooking a recipe", "watching a video", etc...). Actions and objects help you personalize the messages you post to people's walls.
It's worth noting that if you define a custom Action, Facebook needs to approve it before they're willing to let just anyone use it. Normally it's not terribly difficult...you just have to click on a "Submit" button next to the Action and it will tell you if / when it gets approved.
So now we've gotten the basics out of the way, let's talk about how to implement something like this on your pages. As I'm sure you're well aware, Open Graph makes use of FB.api() instead of FB.ui(). I'm going to use a Javascript example here.
FB.api(
'/me/app_namespace:share',
'post',
{
pet_who_needs_a_home: document.location.href,
image: pet_image // optional
},
function(response) {
// You can do something with the response here.
// If successful, Facebook returns the post id of the post it just made
// If it fails, check response.error
}
);
There's also two very important tags that you need in your <head> tag. And here they are:
<meta property="fb:app_id" content="YOUR_APP_ID" />
<meta property="og:type" content="APP_NAMESPACE:pet_who_needs_a_home" />
Now let me talk you through what everything is. FB.api() is rather obvious so I'll skip onto...
'/me/app_namespace:share',
/me is posting to your wall. app_namespace is the namespace found in your app details section on developers.facebook.com. You may need to define a namespace (settings->basic->second text box). the ":" breaks the namespace and action. Share is the action (defined, again, on developers.facebook.com).
'post',
Tells Facebook that we want to use a POST request (as opposed to a GET request).
{
pet_who_needs_a_home: document.location.href,
image: pet_image // optional
},
This is (obviously) a javascript array of two important values. "pet_who_needs_a_home" is the (actually my...you should replace that with whatever yours is) object type (still on developers.facebook.com) which, as you recall, helps us define the language used, like in the image above. Image is an optional field in which you can define the image that will be shared through open graph. There are a slew of other optional fields that you can check at...you know.
function(response) {
...and all that is kind of obvious so I'll spare the pointless details there. As I mentioned in the comments, it returns either the post id of the post if successful, or an error (found in response.error) that may or may not be descriptive.
The meta tags, I hope, speak for themselves. YOUR_APP_ID is...you guessed it...your app ID. All numeric. app_namespace is your namespace, again. pet_who_needs_a_home is (my) object and should be replaced with whatever object you happen to be using.
Sorry for the long post. Hopefully that sort of cleared that up a little bit.
this will post the exact same post as of weForPresident via your appName. please change your messages accordingly. and access token should have publish_actions extended permission
$attachment = array(
'access_token' => $access_token,
'message' => "I Just Join WeForPresident",
'name' => "WeForPresident",
'description' => "philippe harewood just started gamng the election on weForPresident and could possibly win some cool stuff",
'link' => "any link to external site",
'picture' => "image link to display in left box"
);
$facebook->api("me/feed","POST",$attachment);
hope it helps.
update: javascript dialog for above solution will be something like below, which will prompt user to post and so will not need publish_actions extended permission:
<html xmlns='http://www.w3.org/1999/xhtml'
xmlns:fb='https://www.facebook.com/2008/fbml'>
<head>
<title>My Feed Dialog Page</title>
</head>
<body>
<div id='fb-root'></div>
<script src='http://connect.facebook.net/en_US/all.js'></script>
<p id='msg'></p>
<script>
FB.init({appId: '#############', status: true, cookie: true});
// calling the API ...
var obj = {
method: 'feed',
link: 'any external url',
picture: 'picture url to show up in left',
name: 'name of the post: comes as heading in blue color within box',
description: 'post description, that comes within box'
};
function callback(response) {
}
FB.ui(obj, callback);
</script>
</body>
</html>";
complete code for such post : first download the php-sdk from https://github.com/facebook/facebook-php-sdk
<?php
include_once "facebook-sdk/facebook.php";
$facebook = new Facebook(array(
'appId' => APP_ID,
'secret' => APP_SECRET,
));
if(isset($_GET['code']))
{
$access_token = $facebook->getAccessTokenFromCode($_GET['code'],$_SESSION['redirect_uri']);
$facebook->setAccessToken($access_token);
$attachment = array(
'access_token' => $access_token,
'message' => "$message",
'name' => "$name",
'description' => "$description",
'link' => "any external link",
'picture' => "picture url"
);
$facebook->api("me/feed","POST",$attachment);
}
else
{
$scope = "publish_stream";
$params = array('scope' => $scope);
$loginUrl = $facebook->getLoginUrl($params);
echo("<script> top.location.href='" . $loginUrl . "'</script>");
}
?>
This ended up being a bug which is not fixed and has a current state of "triaged"
http://developers.facebook.com/bugs/138798476259001
The only solution so far seems to be adding the action paramaters

This comment has not yet been published to Facebook

I am using FB:Comments on my page using XFBML. When I post a comment, an error comes up with the message "This comment has not yet been published to Facebook"
This is the code that I am using apart from the fb:comments tag
<div id="fb-root"></div>
<script>window.fbAsyncInit = function() {
FB.init(
{appId :'APP ID',status:true,cookie:true,xfbml:true});
};
(function(){var e=document.createElement('script');
e.async=true;
e.src=document.location.protocol+'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);}());
</script>
It looks this problem comes with ".info" domains.
Or it might be that this happens with top level domains with 4 or more letters, like .info, .name or .mobi, though I haven't investigated into all of them.
What attributes do you have set on the fb:comments tag? I believe all that's doing is the facebook connect/login side of things. Have you got the correct OG tags in place? You could also add in code to subscribe to the add comment event and see what's going on:
<script>
FB.Event.subscribe('comments.add', function(resp) {
for(var i in resp){
if(resp.hasOwnProperty(i)){
console.log(i + " " + resp[i]);
}
}
});
</script>
you may also need the channel file as detailed here https://developers.facebook.com/docs/reference/javascript/
I'm having the same problem. If I use the example page (http://developers.facebook.com/docs/reference/plugins/comments/) the comment gets posted on my wall, whereas doing the same in the comment box of my app does not, unless I pint them to a Facebook URL.
This works:
<fb:comments href="http://www.facebook.com/any-url/" ></fb:comments>
This doesn't if I do it from my app, but it works if I do it from my site (which doesn't really help for the purpose I need it to)
<fb:comments href="http://www.mysite.com/any-other-url/" ></fb:comments>

How to publish to my own page's wall on Facebook

I just can't find out how to do this.
I'm building a website in scala (on google app-engine) and I made a facebook page for it and created a facebook application. All I want to do is to post to my own page's wall. I don't want to use java facebook api, 'cause I think it's way too much to do such a simple thing, but I really can't find a simple way to do so.
Is there a "low level" facebook api?? something simpler that works on posts and gets like twitter api for example?
Or any idea or alternative way to do so will be appreciated.
Thanks!
Facebook has an API that you can use, but it isn't quite as straightforward as the Twitter API. It would be a bit of overkill to write in support, unless perhaps you are prototyping something for someone else to use.
For an individual case, you might be best served by using Posterous- if you setup a Posterous account linked to your Facebook Profile, emailing facebook#posterous.com with the sender set as yourself will likely be the easiest way to post content to your wall. With this, you can use any SMTP email-capable library that supports either HTML emails or attachments. An added bonus is that you can also cross-post to twitter and a number of other places from Posterous by altering the destination Posterous email.
Incidentally, Posterous also has an API too, but I don't remember off the top of my head if you can redirect where posted materials are sent through the API. I've only used it for image uploads, myself.
Here is a strait forward out of the box wall feed example using Javascript SDK
SDK connection, just change the appId to your Applications own ID.
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '135669679827333',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
//channelUrl : 'http://WWW.MYDOMAIN.COM/channel.html', // channel.html file
oauth : true // enable OAuth 2.0
});
if (window!=window.top) {
FB.Canvas.setAutoResize();
}
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
Post Script, notice the to: parameter, change this to the page you wish to post to. You can edit all other fields as needed.
<script language="javascript" type="text/javascript">
//<![CDATA[
function feedthis() {
FB.ui({ method: 'feed',
message: 'Testing Feed',
caption: 'This is the Caption value.',
name: 'Testing JS feed dialog on ShawnsSpace',
link: 'http://shawnsspace.com?ref=link',
to: '391793380398',
description: 'Testing property links, and action links via Feed Dialog Javascript SDK',
picture: 'https://shawnsspace.com/ShawnsSpace.toon.nocolor..png',
properties: [{ text: 'Link Test 1', href: 'http://shawnsspace.com?ref=1'},
{ text: 'Link Test 2', href: 'http://shawnsspace.com?ref=2'},
{ text: 'Link Test 3', href: 'http://shawnsspace.com?ref=3'},
{ text: 'Link Test 4', href: 'http://shawnsspace.com?ref=4'}
],
actions: [
{ name: 'Shawn', link: 'http://ShawnsSpace.com'}
]
});
};
//]]>
</script>
<button onclick="feedthis();">Post to Wall</button>
There are two steps required to do this:
Create a custom Facebook App and add it as a tab to your page
Set this newly added tab as the default when a new user visits your page
Details:
Create a custom Facebook App and add it as a tab to your page
This step is tricky but manageable for an average HTML programmer. To illustrate it best, I will point to a great tutorial on this:
http://how-to-create-facebook-app.koliber.com/
Set the tab as default
As the admin, go to your page
In the upper-right corner click on "Edit Page"
Under the heading "Default Landing Tab", select the tab which
contains the application you created earlier.
Well, I found there is a REST-like api:
This means that our Facebook method calls are made over the internet by sending HTTP GET or POST requests to the Facebook API REST server (http://api.facebook.com/restserver.php) . Nearly any computer language can be used to communicate over HTTP with the REST server.
Documentation here: http://wiki.developers.facebook.com/index.php/API