02-02-2013, 05:02 PM
|
PM User |
#3
|
|
New to the CF scene
Join Date: Feb 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
Quote:
Originally Posted by cloudstryphe
Hello. I built a website that interfaces with the Twitter API. Recently I decided to transfer my entire website onto a framework (codeigniter).
My issue is as follows.
In my Models I have the following
Code:
public function settwconfig(){
$userid = $this->input->cookie("userid_cookie");
$this->load->config("twitter");
$this->load->library("TwitterOAuth");
if($_SESSION['username'] == "" OR $_SESSION['username'] == NULL) {
$sql = "SELECT * FROM `user_twtokens` WHERE `userid` = ?";
$query = $this->db->query($sql, $userid);
$row = $query->row();
$_SESSION['username'] = $row->username;
$_SESSION['oauth_uid'] = $row->oauth_uid;
$_SESSION['oauth_provider'] = $row->oauth_provider;
$_SESSION['oauth_token'] = $row->oauth_token;
$_SESSION['oauth_secret'] = $row->oauth_secret;
}
$twitteroauth = new TwitterOAuth($this->config->item('twitter_consumer_token'), $this->config->item('twitter_consumer_secret'), $_SESSION['oauth_token'], $_SESSION['oauth_secret']);
return $twitteroauth;
})
I use this method to initialize Twitter then call it in another function where I make a call like such:
Code:
public function feed() {
$twitteroauth = $this->settwconfig();
$feed = $twitteroauth->get('statuses/home_timeline', array('count' => 25));
return $feed;
})
When put in a view, the feed displays fine and I get all the tweets I want, but I get 4 errors saying that "Message: Missing argument 1 for TwitterOAuth::__construct()" and I have no idea why. The feeds are working fine but I don't understand how the class is errorirng out yet still giving me the feed.
The library I'm using is the following: https://github.com/abraham/twitteroauth
This has been killing me. All help is welcome 
|
I had the same problem... this is what I did...
In twitterauth it doesn't have a default value...
so from
function __construct($consumer_key, $consumer_secret, $oauth_token = NULL, $oauth_token_secret = NULL) {
to
function __construct($consumer_key = '', $consumer_secret = '', $oauth_token = NULL, $oauth_token_secret = NULL) {
Solved
|
|
|