{"id":21429378,"url":"https://github.com/nystudio107/disqus","last_synced_at":"2025-07-14T10:32:55.695Z","repository":{"id":31784738,"uuid":"35351160","full_name":"nystudio107/disqus","owner":"nystudio107","description":"DEPRECATED Integrate the Disqus commenting system into Craft CMS websites, including Single Sign On (SSO) and custom login/logout URLs.","archived":false,"fork":false,"pushed_at":"2019-01-01T23:31:49.000Z","size":53,"stargazers_count":26,"open_issues_count":0,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-01T12:57:09.008Z","etag":null,"topics":["craft-plugin","craftcms","disqus"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nystudio107.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-10T00:41:25.000Z","updated_at":"2023-12-13T00:22:00.000Z","dependencies_parsed_at":"2022-09-10T12:21:44.019Z","dependency_job_id":null,"html_url":"https://github.com/nystudio107/disqus","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nystudio107%2Fdisqus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nystudio107%2Fdisqus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nystudio107%2Fdisqus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nystudio107%2Fdisqus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nystudio107","download_url":"https://codeload.github.com/nystudio107/disqus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225970889,"owners_count":17553411,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["craft-plugin","craftcms","disqus"],"created_at":"2024-11-22T22:17:33.502Z","updated_at":"2024-11-22T22:17:34.420Z","avatar_url":"https://github.com/nystudio107.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![No Maintenance Intended](http://unmaintained.tech/badge.svg)](http://unmaintained.tech/)\n\n# DEPRECATED\n\nThis Craft CMS 2.x plugin is no longer supported, but it is fully functional, and you may continue to use it as you see fit. The license also allows you to fork it and make changes as needed for legacy support reasons.\n\nThe Craft CMS 3.x version of this plugin can be found here: [craft-disqus](https://github.com/nystudio107/craft-disqus) and can also be installed via the Craft Plugin Store in the Craft CP.\n\n# Disqus plugin for Craft CMS\n\nIntegrate the [Disqus](https://disqus.com) commenting system into [Craft CMS](http://buildwithcraft.com) websites, including Single Sign On (SSO) and custom login/logout URLs.\n\nRelated: [Disqus for Craft 3.x](https://github.com/nystudio107/craft3-disqus)\n\n**Installation**\n\n1. Download \u0026 unzip the file and place the `disqus` directory into your `craft/plugins` directory\n2.  -OR- do a `git clone https://github.com/nystudio107/disqus.git` directly into your `craft/plugins` folder.  You can then update it with `git pull`\n3.  -OR- install with Composer via `composer require nystudio107/disqus`\n4. Install plugin in the Craft Control Panel under Settings \u003e Plugins\n5. The plugin folder should be named `disqus` for Craft to see it.  GitHub recently started appending `-master` (the branch name) to the name of the folder for zip file downloads.\n\n## Configuring Disqus\n\nFirst, make sure you have [set up a Disqus account](https://disqus.com/websites/).\n\nNext in the Craft Admin CP, go to Settings-\u003ePlugins-\u003eDisqus and enter the Short Name for your Disqus site.  This is the only required setting for the Disqus plugin.\n\nAll settings are also configurable via the `config.php` file, which is a multi-environment friendly way to store the default settings.  Don't edit this file, instead copy it to `craft/config` as `disqus.php` and make your changes there.\n\n### Single Sign On (SSO)\n\nThe real usefulness of the Disqus plugin is that it takes care of the Single Sign On (SSO) integration with your Craft site.\n\nBefore you can use this, you'll need to set up the Disqus SSO API as described on the [Integrating Single Sign-On](https://help.disqus.com/customer/portal/articles/236206-integrating-single-sign-on) web page.\n\nThen copy and paste the API Key and API Secret into the Disqus plugin settings, and turn on the \"User Single Sign On\" lightswitch.\n\n### Custom Login/Logout URLs\n\nThe Disqus plugin will also take care of the custom login/logout URLs, should you wish to use them.  Please see [Adding your own SSO login and logout links](https://help.disqus.com/customer/portal/articles/236206-integrating-single-sign-on#sso-login) for details.\n\nYou only need this is you want to have a custom login button displayed in the Disqus UI itself.  \n\n`url` should be the address of your login page. The page will be opened in a new window and it must close itself after authentication is done. That is how we know when it is done and reload the page.\n\n`logout` should be set to `http://example.com/actions/disqus/logoutRedirect` to hit the Disqus controller that handles the logout and redirect.\n\n## Using the Disqus plugin in your templates\n\nAll of these methods accomplish the same thing:\n\n    {# Output the Disqus embed code using the 'disqusEmbed' function #}\n    {{ disqusEmbed( DISQUS_IDENTIFIER, DISQUS_TITLE, DISQUS_URL, DISQUS_CATEGORY_ID, DISQUS_LANGUAGE) }}\n\n    {# Output the Disqus embed code using the 'disqusEmbed' filter #}\n    {{ DISQUS_IDENTIFIER | disqusEmbed(DISQUS_TITLE, DISQUS_URL, DISQUS_CATEGORY_ID, DISQUS_LANGUAGE) }}\n\n    {# Output the Disqus embed code using the 'disqusEmbed' variable #}\n    {{ craft.disqus.disqusEmbed( DISQUS_IDENTIFIER, DISQUS_TITLE, DISQUS_URL, DISQUS_CATEGORY_ID, DISQUS_LANGUAGE) }}\n\nAll of the parameters except for `DISQUS_IDENTIFIER` are optional.  For more information on what these parameters are, please see [Javascript configuration variables](https://help.disqus.com/customer/portal/articles/472098-javascript-configuration-variables)\n\nDisqus ignores any settings that are empty strings, e.g.: `''`\n\nThe typical Twig tag you'll use would look like this:\n\n    {{ disqusEmbed(entry.slug, entry.title, entry.url) }}\n\n...which will result in comments that are unique on a per-entry basis.\n\nIn its most basic case, this will result in output to your Craft template that looks like this:\n\n    \u003cdiv id=\"disqus_thread\"\u003e\u003c/div\u003e\n    \u003cscript data-cfasync=\"false\" type=\"text/javascript\"\u003e\n        /**\n         *  RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.\n         *  LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables\n         */\n\n        if (typeof disqus_config !== 'undefined') {\n            var _old_disqus_config = disqus_config;\n        }\n        var disqus_config = function() {\n            if (typeof _old_disqus_config !== 'undefined') {\n                _old_disqus_config.apply(this);\n            }\n            this.page.url = 'DISQUS_URL';\n            this.page.identifier = 'DISQUS_IDENTIFIER';\n            this.page.title = 'DISQUS_TITLE';\n            this.page.category_id = 'DISQUS_CATEGORY_ID';\n            this.language = 'DISQUS_LANGUAGE';\n        };\n\n        (function() {  // REQUIRED CONFIGURATION VARIABLE: EDIT THE SHORTNAME BELOW\n            var d = document, s = d.createElement('script');\n\n            s.src = '//DISQUS_SHORTNAME.disqus.com/embed.js';  // IMPORTANT: Replace EXAMPLE with your forum shortname!\n\n            s.setAttribute('data-timestamp', +new Date());\n            (d.head || d.body).appendChild(s);\n        })();\n    \u003c/script\u003e\n    \u003cnoscript\u003ePlease enable JavaScript to view the \u003ca href=\"https://disqus.com/?ref_noscript\" rel=\"nofollow\"\u003ecomments powered by Disqus.\u003c/a\u003e\u003c/noscript\u003e\n\nThe `DISQUS_SHORTNAME` setting is taken from the Admin CP or `config.php` settings, and the rest of the `DISQUS_*` settings are passed in as variables from the `disqusEmbed` Twig filter/function.\n\nIf you have turned on \"User Single Sign On\" it will also output something like this inside the above tag:\n\n    this.page.remote_auth_s3 = \"eyJpZCI6IjEiLCJ1c2VybmFtZSI6IkFkbWluIiwiZW1haWwiOiJhbmRyZXdAbWVnYWxvbWFuaWFjLmNvbSJ9 c0e4b8f2eca3c0e995cdd64ba2dedd720820ab5b 1431214361\";\n    this.page.api_key = \"GTX1r1JBbiJah3hzZkBO06hI71VxjyWxgdurckHYBWLiELkHDidVmnDkBW0XeROe\";\n\nWhich, assuming you've set up the Disqus SSO properly, will allow your Craft users to be logged into Disqus using your Craft website credentials.\n\nIf you have \"Use Custom Login/Logout URLs\" turned on, it will also generate the `this.sso` settings for you, [as described here](https://help.disqus.com/customer/portal/articles/236206-integrating-single-sign-on#sso-login)\n\n## Disqus Multi-lingual websites\n\nBy default, Disqus will use the language you have set in `Disqus Admin \u003e Setup \u003e Appearance`, however you can use it on [Multi-lingual websites](https://help.disqus.com/customer/portal/articles/466249-multi-lingual-websites) as well.\n\nThe `DISQUS_LANGUAGE` parameter you can provide to `{{ disqusEmbed() }}` allows you to control the language that the Disqus embed is displayed in. The comments, however, will still be the same for all languages.\n\nIf you wish to have the comments themselves be different per-language, you can do something like:\n\n    {{ disqusEmbed(entry.slug ~ \"_\" ~ entry.locale, entry.title, entry.url, '', entry.locale ) }}\n\nThis will result in comments that are different for each language, and the Disqus embed will be displayed in the same language as the comments.\n\nBrought to you by [nystudio107](http://nystudio107.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnystudio107%2Fdisqus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnystudio107%2Fdisqus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnystudio107%2Fdisqus/lists"}