DABR – Setting FB Connect pada Twitter Client

Posted on 1,182 views

Halo gan, tadi saya sudah buat tutorial DABR – Setting Auto Refresh Interval kali ini saya akan setting fb connect. Kalau saya liat di kaskus banyak sekali yang konflik dengan tutorial ini, kali ini saya akan membahas lengkap secara men-detail. Sebenernya tutorial ini murni hasil dari agan [email protected] terima kasih sebelumnya saya cuma mau membahas ulang di blog saya tercinta. Langsung

// Extract folder fbconnect ke common
// Buka fbconfig.php dan masukkan appid, appsecret, dan Canvas URL aplikasi agan

/* ================================================================================ */
// Tambahkan pada menu_register() di twitter.php

'fb' => array(
'security' => true,
'callback' => 'fb_connect_page',
),
'fblogout' => array(
'hidden' => true,
'security' => true,
'callback' => 'fb_logout',
),

// Membuat Fungsi FB Connect Page di twitter.php

function fb_connect_page(){
include_once "fbconnect/fbconfig.php";

if(!$user_id){
$content = "Click this connect button to start Facebook Connect:<br />";
$content .= "<div><a href='".$loginUrl."&display=touch'>Connect</a></div>";
}else{
//$content .= "Success, you are connected to Facebook.<br />";
$content = "Hello <a href='http://m.facebook.com/profile.php?id=".$user_id."' target='_blank'>".$user_name."</a>, you are connected to Facebook.<br />";
$content .= "<div><a href='fblogout'>Disconnect</a></div>";
}
theme('page', 'FB Connect', $content);
}

// Membuat Fungsi FB Logout di twitter.php

function fb_logout(){
include_once "fbconnect/fbconfig.php";

$facebook = new Facebook($config);
unset($_SESSION['fb_' . $facebook->getAppId() . '_code']);
unset($_SESSION['fb_' . $facebook->getAppId() . '_access_token']);
unset($_SESSION['fb_' . $facebook->getAppId() . '_user_id']);
header('Location: '. $facebook->getLogoutUrl(array('next' => $config['baseurl'])));
die();
theme('page', "FB Logout", $content);
}

// Menambah fungsi untuk update ke facebook
// Cari fungsi twitter_update() lalu sesudah code

function twitter_update() {

// Tambahkan code

include_once "fbconnect/fbconfig.php";

// Masih di fungsi twitter_update cari code ini

setcookie_year('geo', $geo);
$b = twitter_process($request, $post_data);

// Lalu tambahkan code berikut sesudah kode di atas

if($_POST['fb'] == 'yes') { 
$facebook->api("/$user_id/feed", 'post', array('message'=> $status));
}

/* ================================================================================ */

// Membuat Option Post to FB di desktop.php
// Sebelum code

if (user_is_authenticated()) {
if ($_SERVER['HTTPS'] == "on") {

// Tambahkan code

include_once "common/fbconnect/fbconfig.php";

// Kemudian sebelum code

.....
// adding ?status=foo will automaticall add "foo" to the text area.
if ($_GET['status'])
.....

// Tambahkan code

if(!$user_id){
$post_fb = "<a href='fb'>Post to FB</a>";
}else{
$post_fb = "<label><input type='checkbox' name='fb' value='yes'>Post to FB</label>";
}

// Lalu Tambahkan code

<span id="fb">'.$post_fb.'</span>

// Sesudah code

<span id="remaining">140</span>

Jika sudah coba di cek login dengan facebook, dan jika berhasil maka selamat. Jika tidak berhasil bisa komentar di kolom komentar di bawah. Semoga Bermanfaat. Sekian. 😀
Download FB_Connect_by_makeatweet.com.rar

Gravatar Image
Seorang warga negara Indonesia biasa. Pengguna sistem windows dan linux. Contact : admin [at] nugi.biz

3 thoughts on “DABR – Setting FB Connect pada Twitter Client

  1. gan ane dah coba , tetapi klo di connect kan selalu keluar gini :

    Error
    Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App’s settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App’s domains.

    kira-kira kenapa ya gan?

Leave a Reply to Nugi Abdiansyah Cancel reply