There is a cool Facebook feature that you can easily implement, inviting or sending messages to Facebook friends with Facebook SDK
Just build a module, a block or whatever you want and put this code in
What is important is to have a FB app and FB APP ID that you have set in some variable, I am using it here with
variable_get('fb_app_id', NULL)
We are using here SEND https://developers.facebook.com/docs/sharing/reference/send-dialog but you can also use other types like invite, request etc https://developers.facebook.com/docs/games/requests/v2.1
I am even using redirect after submit in this module below, but other way you could do it is just add JS to link like
$fb_link = '<div class="fb_link"><a href="#" onclick="FacebookInviteFriends();">Invite Facebook friends</a></div>';
function my_custom_invite(){
$node_id = arg(1); //filter_input(INPUT_GET, 'node_id');
$node = node_load($node_id);;
$team_id = $node ->field_team_id['und'][0]['value'];
Global $base_url;
if(isset($node_id )){
$fb_content = '<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
appId:"'.variable_get('fb_app_id', NULL).'",
cookie:true,
status:true,
version:"v2.0",
xfbml:true,
redirect_uri: "'.$base_url.'/node/'.$node_id.'",
});
function FacebookInviteFriends()
{
FB.ui(
{
method: "send",
link: "'.$base_url.'/node/'.$node_id.'",
}
);
}
</script>';
$fb_link_url = 'http://www.facebook.com/dialog/send?app_id='.variable_get("simple_fb_connect_appid", NULL).'&link='.$base_url.'/node/'.$node_id.'&redirect_uri='.$base_url.'/node/'.$node_id;
print $fb_link_url ;
}