Monday, February 23, 2009

How ro use show extended permission on page other then fb connect login button.

FB.Bootstrap.requireFeatures(["Connect"], function() { FB.Facebook.init("", ""); FB.Connect.showPermissionDialog("email"); });

---------------------------------------------------------------------------------------
Correct way to use to get permission only if user have not grantd a parmission...
Code is:



var is_initialized = false;
// Ensure Facebook app is initialized and call callback afterward
function ensure_init(callback) {
if(window.is_initialized) {
callback();
} else {
FB_RequireFeatures(["XFBML"], function() {
//FB.FBDebug.logLevel = 4;
//FB.FBDebug.isEnabled = true;

FB.Facebook.init(, );

window.is_initialized = true;
callback();
});
}
}



function facebook_prompt_permission(permission, callbackFunc) {
ensure_init(function() {
//check is user already granted for this permission or not
FB.Facebook.apiClient.users_hasAppPermission(permission,
function(result) {
// prompt offline permission
if (result == 0) {
// render the permission dialog
FB.Connect.showPermissionDialog(permission, callbackFunc);
} else {
// permission already granted.
callbackFunc(true);
}
});
});
}

function statusSubmit() {

// this checks current status of permission and if not granted it will display an ajax box for user to give permission.
facebook_prompt_permission('email', function(accepted) {
if(accepted) {
// do something here. I send the status that the user has written to FB via an AJAX request.
alert("hiii");
var result=FB.Facebook.apiClient.users_getInfo(UID,'proxied_email',function (result,ex) { alert("here lets try "+result[0]['proxied_email']);});

}
else {
alert("bii");
}
});
}
----------------------------------------------------------
call
statusSubmit();

Facebook connect invitaion request:how to

The code to display extended permission is as given below. Call popupFacebookInvite() function to display the extended permission dialog box. Its pretty simple, So try out today...


function popupRequestForm(){
FB.IFrameUtil.CanvasUtilServer.run(true);
var _e1=document.createElement("div");
_e1.setAttribute("iframeHeight","560px");
_e1.setAttribute("iframeWidth","630px");
var _e2=new FB.UI.PopupDialog("Your message here",_e1,false,false);
_e2.setContentWidth(630);
_e2.setContentHeight(560);
_e2.set_placement(FB.UI.PopupPlacement.center);
_e1.setAttribute("fbml",""+"\">"+""+""+"");
_e2.show();
FB_RequireFeatures(["XFBML"],function(){
var _e3=new FB.XFBML.ServerFbml(_e1);
FB.XFBML.Host.addElement(_e3);
});
}
function popupFacebookInvite(){
FB.Facebook.get_sessionState().waitUntilReady(Delegate.create(null,function(_e4){
FB.Facebook.apiClient.connect_getUnconnectedFriendsCount(function(o,e){
if(o>1){
FB.Connect.inviteConnectUsers();
}else{
popupRequestForm();
}
});
}));
return false;
}

Building Successful Products in the Maze of a Large Organization

  *Image is generated using AI Large organizations offer a treasure trove of resources and stability for product development. However, navig...