Disqus
Integrates the Disqus third-party commenting system to replace or enhance Drupal's native comments with a powerful, feature-rich discussion platform.
disqus
Install
composer require 'drupal/disqus:^2.0'
Overview
The Disqus module provides seamless integration with the Disqus commenting platform, enabling site administrators to replace Drupal's native comment system with Disqus's robust discussion features. Disqus offers real-time commenting, social media integration, moderation tools, and spam filtering—all managed through Disqus's web interface.
The module implements a field-based architecture, allowing Disqus comments to be enabled on any fieldable entity type (nodes, users, custom entities). This provides granular control over which content types support Disqus commenting. Additionally, the module provides multiple display blocks for showcasing community engagement, including recent comments, popular threads, and top commenters widgets.
Advanced features include Single Sign-On (SSO) integration for seamless authentication between Drupal and Disqus, Google Analytics event tracking for new comments, email notifications to content authors when new comments are posted, and full API integration for synchronizing thread updates and deletions between Drupal and Disqus. The module also supports migration from Drupal 7 installations and bidirectional comment migration between Drupal and Disqus.
Features
- Field-based Disqus commenting that can be added to any content entity type (nodes, users, custom entities)
- Real-time comment embedding with JavaScript-based loading for optimal performance
- Single Sign-On (SSO) integration allowing users to comment with their Drupal credentials on Disqus
- Four configurable blocks: Combination Widget, Popular Threads, Recent Comments, and Top Commenters
- Views integration providing a Disqus Comment Count field handler for displaying comment counts in Views
- Google Analytics event tracking for new comments (requires Google Analytics module)
- Email notifications to content authors when new comments are posted on their content
- API integration to automatically update Disqus threads when entity titles or URLs change
- Configurable thread closure or removal when entities are deleted
- Full migration support from Drupal 7 Disqus configurations and field instances
- Comment import capability from Disqus to Drupal using the Migrate API
- Comment export capability from Drupal to Disqus using the Migrate API
- Localization support to override Disqus language with the site's current language
- User credential inheritance to pre-fill the Disqus guest form with logged-in user information
- Customizable JavaScript callbacks for extending Disqus behavior
- Noscript fallback for users with JavaScript disabled
Use Cases
Replace Native Comments with Disqus
Site administrators looking to replace Drupal's native comment system can add a Disqus comment field to their content types. This provides spam filtering, social login options, real-time commenting, and centralized moderation through Disqus's web interface—without managing comment infrastructure on the Drupal server.
Display Engagement Widgets in Sidebar
Use the Disqus blocks to showcase community activity in your site's sidebar or footer regions. The 'Recent Comments' block shows latest discussions, 'Popular Threads' highlights trending content, and 'Top Commenters' recognizes active community members—all encouraging visitor participation.
Unified Authentication with SSO
Organizations requiring users to use their Drupal credentials for commenting can enable Single Sign-On. Users clicking 'Login' in Disqus are redirected to Drupal's login form, and upon authentication, can immediately comment without creating a separate Disqus account.
Track Comment Engagement in Analytics
Marketing teams wanting to understand user engagement can enable Google Analytics tracking. Each new comment triggers a 'Disqus/Comment' event in GA, allowing analysis of which content generates the most discussion and user interaction patterns.
Migrate from Drupal 7 Disqus Installation
Sites upgrading from Drupal 7 can use the included migration paths to automatically transfer Disqus settings, field configurations, and entity display settings to Drupal 9/10/11, maintaining continuity of their commenting system.
Import Existing Disqus Comments to Drupal
Sites transitioning away from Disqus can use the comment import migration to fetch all comments from Disqus and create them as native Drupal comments, preserving discussion history in the Drupal database.
Author Notifications for New Comments
Content creators who want to stay informed about discussions on their articles can benefit from the email notification feature. When enabled, authors receive an email whenever someone comments on their content, enabling timely responses and community engagement.
Tips
- Add the Disqus field to content types before creating content to ensure proper thread initialization.
- Use custom thread identifiers when migrating content between environments to maintain comment continuity.
- Place Disqus blocks strategically to encourage engagement without overwhelming the page layout.
- Configure SSO early if you plan to use it—changing later may cause user account mismatches.
- Test your Disqus integration in a development environment before deploying to production.
- Consider enabling localization support for multilingual sites to improve the user experience.
- Use the Views integration to display comment counts in content listings and encourage discussion.
Technical Details
Admin Pages 1
/admin/config/services/disqus
Configure Disqus integration settings including your shortname, behavior options, API credentials, and Single Sign-On settings.
Permissions 4
Hooks 1
hook_disqus_user_data_alter
Modify user data prepared for use with Disqus Single Sign-On. Allows modules to customize user information sent to Disqus.
Troubleshooting 6
Verify that the Disqus shortname is correctly configured at /admin/config/services/disqus. Check that the user has 'view disqus comments' permission. Ensure JavaScript is enabled in the browser and no ad blockers are interfering with disqus.com scripts.
Comment counts require the Disqus JavaScript to load successfully. The count display also depends on using the correct thread identifier. Verify your shortname is correct and check browser console for JavaScript errors.
Ensure the Disqus PHP API bindings are installed via Composer. Verify your API keys (public key, secret key, user access token) are correctly entered. Check that your Disqus application has the required permissions at disqus.com/api/applications/.
SSO requires both public key and secret key to be configured. Ensure 'Use Single Sign-On' is enabled in advanced settings. The user must have permission to log in to Drupal. Check that the SSO configuration in your Disqus application settings matches your site.
Enable 'Update Threads' in the API settings section. This requires the DisqusAPI class to be available and a valid user access token. Check the Drupal logs for API error messages.
This feature requires a valid secret key for API access. Enable 'Notify authors of new comments' in behavior settings. The content entity must implement EntityOwnerInterface. Check Drupal's mail system configuration and logs.
Security Notes 5
- API keys (especially the secret key and user access token) should be kept confidential. Never expose them in client-side code or version control.
- The new comment notification endpoint includes flood protection to prevent abuse, but consider additional rate limiting for high-traffic sites.
- SSO authentication uses HMAC-SHA1 signing to verify user credentials between Drupal and Disqus.
- The module respects Drupal's permission system—ensure 'view disqus comments' is granted only to appropriate roles.
- When using the comment import migration, validate that comments originate from your legitimate Disqus forum.