The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
Assistance Required...
 
Share:
Notifications
Clear all

Question Assistance Required for Tutor LMS - wpDiscuz Integration Plugin Development

1 Posts
1 Users
0 Reactions
13 Views
Posts: 1
Topic starter
(@indigetal)
New Member
Joined: 7 hours ago

I am developing an integration plugin to enable wpDiscuz as the default comment system for Tutor LMS lessons. The primary goal is to replace the default Tutor LMS comment system with wpDiscuz, injecting the comments into the lesson sidebar rather than the main content area. While the integration plugin works well in concept, we have encountered issues related to wc_options that are preventing the integration from functioning as intended.

Below is an overview of the integration plugin, the specific issues we’re facing, and the insights we’ve gathered from analyzing wpDiscuz’s code. I can send an invite to collaborate in the repo if there are developers of the wpDiscuz team, or any others that have bona fides.

 

Integration Plugin Overview

The plugin achieves the following:

  1. Replace Tutor LMS Comments: Deregisters the Tutor LMS comment system on lesson pages and replaces it with wpDiscuz.
  2. Enable wpDiscuz for the Lesson Post Type: Ensures the lesson custom post type is included in the wpdiscuz_post_types key of wc_options.
  3. Inject Comments into Sidebar: Dynamically adds wpDiscuz comments to the lesson sidebar for better visibility and user engagement.

 

Issues Encountered

  1. wc_options Missing or Malformed:

    • The wc_options entry in the wp_options table is either missing or does not include the wpdiscuz_post_types key.
    • Logs indicate repeated failures to locate or initialize wpdiscuz_post_types.
  2. wpdiscuz_init_options Action:

    • We use the wpdiscuz_init_options hook to add the lesson post type dynamically:
      add_action('wpdiscuz_init_options', function ($options) {
          if (!isset($options['wpdiscuz_post_types'])) {
              $options['wpdiscuz_post_types'] = [];
          }
          if (!in_array('lesson', $options['wpdiscuz_post_types'], true)) {
              $options['wpdiscuz_post_types'][] = 'lesson';
          }
          update_option('wc_options', $options);
      });
      
    • Despite this, the lesson post type does not persist in wc_options, and wpdiscuz_post_types remains unset.
  3. Comments Not Loading:

    • Since wpdiscuz_post_types is not initialized correctly, the wpDiscuz comments are not loaded for lessons, and Tutor LMS comments are not deregistered.

 

Insights from Analyzing wpDiscuz Code

  1. wc_options Management:

    • wc_options is initialized and validated via addOptions() and initOptions() in class.WpdiscuzOptions.php.
    • The wpdiscuz_post_types key is essential for enabling wpDiscuz on custom post types like lesson.
  2. Dynamic Updates via Hooks:

    • The wpdiscuz_init_options action is available for modifying wc_options. However, it is unclear:
      • When this hook is executed during plugin initialization.
      • Whether there are constraints on modifying wc_options through this hook.
  3. Database Behavior:

    • update_option is used to persist changes to wc_options. However, it appears that either the changes are overwritten or not saved due to potential conflicts or restrictions in wpDiscuz’s logic.

 

Questions

To resolve these issues, we would appreciate your insights on the following:

  1. How does wpDiscuz manage wc_options?

    • Are there scenarios where wc_options is reset or dynamically overwritten, blocking external updates?
    • Does wpDiscuz validate or restrict updates to wc_options made through update_option?
  2. How should wpdiscuz_post_types be updated?

    • Is the wpdiscuz_init_options action the correct method to dynamically add post types like lesson?
    • Are there additional steps needed to ensure the lesson post type persists in wc_options?
  3. Best Practices for Integration:

    • What is the recommended way to enable wpDiscuz for custom post types?
    • Are there known limitations or conflicts when using wpDiscuz with dynamic post types or integrations like Tutor LMS?
  4. Fallback Logic:

    • If wc_options is missing, does wpDiscuz dynamically enable its features for default post types? If so, is it possible to leverage this for custom post types?

 

Thank you for your time and assistance! Please let me know if additional details, code snippets, or logs would be helpful for diagnosing the issue.

Regards,
Brandon
Tutor-wpDiscuz Lesson Integration Plugin

Share: