function twitter_user_page($query) { $screen_name = $query[1]; // echo "<h1>q1 = {$screen_name}</h1>"; $subaction = $query[2]; // echo "<h1>q2 = {$subaction}</h1>"; $in_reply_to_id = (string) $query[3]; // echo "<h1>q3 = {$in_reply_to_id}</h1>"; $content = ''; if (!$screen_name) { // theme('error', 'No username given'); // Ugly cludge because @user is a real user twitter_refresh('user/user'); } // Load up user profile information and one tweet $user = twitter_user_info($screen_name); // If the user has at least one tweet if (isset($user->status)) { // Fetch the timeline early, so we can try find the tweet they're replying to $cb = get_codebird(); $api_options = ""; $per_page = setting_fetch('perPage', 20); $api_options = "&count={$per_page}"; // If we're paginating through if ($_GET['max_id']) { $api_options .= '&max_id=' . $_GET['max_id']; } $api_options .= "&screen_name={$screen_name}"; $user_timeline = $cb->statuses_userTimeline($api_options); twitter_api_status($user_timeline); $tl = twitter_standard_timeline($user_timeline, 'user'); // $content = theme('status_form'); // $content .= theme('timeline', $tl); // theme('page', 'user', $content); } // Build an array of people we're talking to $to_users = array($user->screen_name); // Build an array of hashtags being used $hashtags = array(); // Are we replying to anyone? if (is_numeric($in_reply_to_id)) { $tweet = twitter_find_tweet_in_timeline($in_reply_to_id, $tl); $out = twitter_parse_tags($tweet->text); $content .= "<p>In reply to:<br />{$out}</p>"; // if ($subaction == 'replyall') { $found = Twitter_Extractor::create($tweet->text)->extractMentionedUsernames(); $to_users = array_unique(array_merge($to_users, $found)); // } if ($tweet->entities->hashtags) { $hashtags = $tweet->entities->hashtags; } } // Build a status message to everyone we're talking to $status = ''; foreach ($to_users as $username) { if (!user_is_current_user($username)) { $status .= "@{$username} "; } } // Add in the hashtags they've used foreach ($hashtags as $hashtag) { $status .= "#{$hashtag->text} "; } $content .= theme('status_form', $status, $in_reply_to_id); $content .= theme('user_header', $user); $content .= theme('timeline', $tl); theme('page', "User {$screen_name}", $content); }
function twitter_user_page($query) { $screen_name = $query[1]; $subaction = $query[2]; $in_reply_to_id = (string) $query[3]; $content = ''; if (!$screen_name) { theme('error', 'No username given'); } // Load up user profile information and one tweet $user = twitter_user_info($screen_name); // If the user has at least one tweet if (isset($user->status)) { // Fetch the timeline early, so we can try find the tweet they're replying to $request = API_URL . "statuses/user_timeline.json?screen_name={$screen_name}&include_rts=true&include_entities=true&page=" . intval($_GET['page']); $tl = twitter_process($request); $tl = twitter_standard_timeline($tl, 'user'); } // Build an array of people we're talking to $to_users = array($user->screen_name); // Are we replying to anyone? if (is_numeric($in_reply_to_id)) { $tweet = twitter_find_tweet_in_timeline($in_reply_to_id, $tl); $content .= "<p>In reply to:<br />{$tweet->text}</p>"; if ($subaction == 'replyall') { $found = Twitter_Extractor::extractMentionedScreennames($tweet->text); $to_users = array_unique(array_merge($to_users, $found)); } } // Build a status message to everyone we're talking to $status = ''; foreach ($to_users as $username) { if (!user_is_current_user($username)) { $status .= "@{$username} "; } } $content .= theme('status_form', $status, $in_reply_to_id); $content .= theme('user_header', $user); $content .= theme('timeline', $tl); theme('page', "User {$screen_name}", $content); }
function twitter_user_page($query) { $screen_name = $query[1]; $subaction = $query[2]; $in_reply_to_id = (string) $query[3]; $content = ''; if (!$screen_name) { theme('error', 'No username given'); } // Load up user profile information and one tweet $user = twitter_user_info($screen_name); // If the user has at least one tweet if (isset($user->status)) { // Fetch the timeline early, so we can try find the tweet they're replying to $request = API_NEW . "statuses/user_timeline.json?screen_name={$screen_name}"; if ($_GET['max_id']) { $request .= '&max_id=' . $_GET['max_id']; } $tl = twitter_process($request); $tl = twitter_standard_timeline($tl, 'user'); } // Build an array of people we're talking to $to_users = array($user->screen_name); // Build an array of hashtags being used $hashtags = array(); // Are we replying to anyone? if (is_numeric($in_reply_to_id)) { $tweet = twitter_find_tweet_in_timeline($in_reply_to_id, $tl); $out = twitter_parse_tags($tweet->text); $content .= "<p>In reply to:<br />{$out}</p>"; if ($subaction == 'replyall') { $found = Twitter_Extractor::create($tweet->text)->extractMentionedUsernames(); $to_users = array_unique(array_merge($to_users, $found)); } if ($tweet->entities->hashtags) { $hashtags = $tweet->entities->hashtags; } } // Build a status message to everyone we're talking to $status = ''; foreach ($to_users as $username) { if (!user_is_current_user($username)) { $status .= "@{$username} "; } } // Add in the hashtags they've used foreach ($hashtags as $hashtag) { $status .= "#{$hashtag->text} "; } $content .= theme('status_form', $status, $in_reply_to_id); $content .= theme('user_header', $user); $content .= theme('timeline', $tl); theme('page', "User {$screen_name}", $content); }