Selasa, 11 September 2012

0 Fitur Edit Profile untuk Dabr (Twitter Client)


Buka file common/twitter.php
kemudian tambahkan kode di menu_register
‘profile’ => array(
‘security’ => true,
‘callback’ => ‘twitter_profile_page’,
),

masih di dalam file yang sama, tambahkan script di bawah ini pada bagian mana aja
function twitter_profile_page() {
// process form data
if ($_POST['name']){
// post profile update
$post_data = array("name" => $_POST['name'],
"url" => $_POST['url'],
"location" => $_POST['location'],
"description" => $_POST['description'],
);
$url = "http://twitter.com/account/update_profile.json";
$user = twitter_process($url, $post_data);
} else {
// retrieve profile information
$user = twitter_user_info(user_current_username());
}
$content = theme(‘user_header’, $user);
$content .= theme(‘profile_form’, $user);
theme(‘page’, "Profile Edit", $content);
}
function theme_profile_form($user){
// Profile form
$out .= "<form name=’profile’ action=’profile’ method=’post’>
<hr />Name: <input name=’name’ maxlength=’20′ value=’{$user->name}’ />
<br />Bio: <input name=’description’ size=40 maxlength=’160′ value=’{$user->description}’ />
<br />Link: <input name=’url’ maxlength=’100′ size=40 value=’{$user->url}’ />
<br />Location: <input name=’location’ maxlength=’30′ value=’{$user->location}’ />";
// Javascript link to use Geo Coordinates
if(!empty($_COOKIE['lat']) && !empty($_COOKIE['long'])){
$out .= " <a href=’javascript:document.forms[\"profile\"].location.value=\"dabr: {$_COOKIE['lat']},{$_COOKIE['long']}\";void(0);’>Use Geo</a>";
}
$out .= "<br /><input type=’submit’ value=’Update’ /></form>";
return $out;
}

0 Comments

Bagaimana Pendapat Anda ?