This is a simple CodeIgniter library for interacting with the Disqus API.
All methods described in the Disqus API documentation are available in this library. Get more info about the API in the API docs. I've also added a few methods for displaying your actual Disqus threads:
echo $this->disqus->js_params(array('disqus_developer'=>'1', 'disqus_url'=>base_url().'blog/post/'.$post->shortname));
The display_thread() method will display the script to pull in the thread for the current request.
I've also added methods to make things a bit simpler:
That will return a string with the number of comments for a given Disqus thread URL, and FALSE if the URL doesn't exist as a Disqus thread.
There are four global variables you can set. They are:
You can use the included config file, or just pass an array of values to the config method:
$this->disqus->config(array( 'forum_id' => $forum_id, 'forum_shortname' => $forum_shortname, 'user_api_key' => $user_api_key, 'forum_api_key' => $forum_api_key ));
Note that config values cascade. That is, a call to the config method will override the config file, and passing values to API methods will override global values set in either the config file or directly through the method.