Recommended:

  • phpclasses.org
  • jsclasses.org
  • jsmag.com
  • siteapps.com
  • View our reviews on Hot Scripts
  • JS Tutorial
  • scripts.com
  • securesignup.com




Recent Comments

Powered by Disqus




Back to articles

Import comments in Disqus

Disqus Import class generates generic xml to import comments from any system into your Disqus forum.

Disqus is the best commenting platfom you will ever get. Seriously, the service it provides is awesome and I used it alot and always recommend to my clients.

But, importing existing comments from non supported platforms into Disqus is a huge pain!

Firstly the import can take up to 24 hours, so it means you can have up to 24 hours between tests. Secondly, sometimes it does not work for no apparent reason. Meaning if you got error, simply retry importing same xml document, it might work perfectly next time.

Thus I created this little script to generate proper generic xml document to be imported into Disqus system. Note, try creating test forum for your first imports ;)

The package contains three classes:
  • Disqus Generator - for generating xml file
  • Disqus Article - to represent webpage/article/blog post objects
  • Disqus Comment - to represent comment objects

Basically what you have to do is to create representing Article and Comment objects, add comments to articles, add articles to Generator and call generate method. Just don't forget to provide as much information as possible for all the objects.

Contents

Download

Examples in action

Example scripts provided with package in action:

Disqus Comment Method list

Set ID of comment

Back to method list

Method nameset_id($id)
Description

Set your systems internal id of comment.

Input parameters

string $id - id of comment

Set author ID of comment

Back to method list

Method nameset_unique_author_id($id)
Description

Set unique ID of author only if you use SSO (Single Sign On) and can uniquely identify the user

Input parameters

string $id - unique id of author

Set author avatar

Back to method list

Method nameset_author_avatar($avatar)
Description

Set avatar of author only if you use SSO (Single Sign On) and can uniquely identify the user

Input parameters

string $avatar - link to author avatar

Set author

Back to method list

Method nameset_author($author)
Description

Set display name of the author, can be unique ID if you use SSO or any other name you wish to display

Input parameters

string $author - display name of author

Set author email

Back to method list

Method nameset_author_email($email)
Description

Set email address of author.

Input parameters

string $email - email of author

Set author url

Back to method list

Method nameset_author_url($url)
Description

Set url author provided (displayed when clicking on their username)

Input parameters

string $url - author's url

Set author IP address

Back to method list

Method nameset_author_ip($ip)
Description

Set IP address of the author

Input parameters

string $ip - author's ip address

Set date of comment

Back to method list

Method nameset_comment_date($date)
Description

Set date when comment was made. Must be YYYY-MM-DD HH:MM:SS 24-hour format.

Input parameters

string $date - date of the comment

Set comment text

Back to method list

Method nameset_content($content)
Description

Set text of comment

Input parameters

string $content - comment text

Set comment status

Back to method list

Method nameset_approved($approved)
Description

Set status of the comments, 0 - inactive, 1 - active.

Input parameters

int $approved - 0 or 1

Set parent of the comment

Back to method list

Method nameset_parent($parent)
Description

If this commend was a reply to another one. Provde system's internal id of the other comment here.

Input parameters

int $parent - ID of the comment this reply was meant for

Disqus Article Method list

Set title of webpage/article

Back to method list

Method nameset_title($title)
Description

Set the title of your webpage/article.

Input parameters

string $title - title of webpage/article

Set link to webpage/article

Back to method list

Method nameset_link($link)
Description

Set canonical link to your webpage/article

Input parameters

string $link - link to webpage/article

Set contents of the webpage/article

Back to method list

Method nameset_contents($contents)
Description

Set the contents of the webpage/article. It can either be just a plain text of article, or whole HTML code of this specific webpage.

Input parameters

string $contents - contents of the webpage/article

Set disqus ID webpage/article

Back to method list

Method nameset_disqus_id($disqus_id)
Description

If you are already using disqus and you set up disqus ID's for specific pages, or you are going to have disqus page ID's, then you can provide them here for each specific webpage/article.

Input parameters

string $disqus_id - disqus id of the webpage

Set post date of webpage/article

Back to method list

Method nameset_post_date($post_date_gmt)
Description

Sets the post date of the webpage/article. Must be YYYY-MM-DD HH:MM:SS 24-hour format.

Input parameters

string $post_date_gmt - post date of webpage/article

Set status of webpage/article

Back to method list

Method nameset_status($status)
Description

Sets the current status of webpage/article. open/closed values are acceptable

Input parameters

string $status - status of webpage/article (open or closed)

Add comment to webpage/article

Back to method list

Method nameadd_comment($comment)
Description

Adds the Disqus Comment object to this specific webpage/article

Input parameters

Disqus Comment $comment - instance of Disqus Comment class

Disqus Generator Method list

Add article to xml

Back to method list

Method nameadd_article($article)
Description

Adds the Disqus Article object to include in XML generation

Input parameters

Disqus Article $article - instance of Disqus Article class

Generate generix XML

Back to method list

Method namegenerate()
Description

Generates XML from all provided articles and comments and returns it as string

Latest changes

None for now

Support

PHP classes support forum or comments below


You may also be interested in:

Powered by BlogAlike.com

blog comments powered by Disqus