I am using the following code to pull in Twitter Posts:
<?php
class TwitterFeed {
public $tweets = array();
public function __construct($user, $limit = 5) {
$user = str_replace(' OR ', '%20OR%20', $user);
$feed = curl_init('http://search.twitter.com/search.atom?q=from:'. $user .'&rpp='. $limit);
curl_setopt($feed, CURLOPT_RETURNTRANSFER, true);
curl_setopt($feed, CURLOPT_HEADER, 0);
$xml = curl_exec($feed);
curl_close($feed);
$result = new SimpleXMLElement($xml);
foreach($result->entry as $entry) {
$tweet = new stdClass();
$tweet->id = (string) $entry->id;
$user = explode(' ', $entry->author->name);
$tweet->user = (string) $user[0];
$tweet->author = (string) substr($entry->author->name, strlen($user[0])+2, -1);
$tweet->title = (string) $entry->title;
$tweet->content = (string) $entry->content;
$tweet->updated = (int) strtotime($entry->updated);
$tweet->permalink = (string) $entry->link[0]->attributes()->href;
$tweet->avatar = (string) $entry->link[1]->attributes()->href;
array_push($this->tweets, $tweet);
}
unset($feed, $xml, $result, $tweet);
}
public function getTweets() { return $this->tweets; }
}
$feed = new TwitterFeed('trekradio', 4);
$tweets = $feed->getTweets();
?>
On this line: $feed = new TwitterFeed('trekradio', 4); - I want to change "trekradio" so it pulls in the following value:
<?php if (have_posts()) { $flag = true; while (have_posts()) { the_post();
if ($flag) { $value = get_cimyFieldValue(get_the_author_ID(), 'twitter-username');
if ($value != NULL) echo "<p><strong>Twitter: </strong> You can follow me on Twitter by <a href=\"http://www.twitter.com/" . cimy_uef_sanitize_content($value) . "\">clicking here!</a></p>";
$flag = false; }}} ?>
How can I do this?