Giter Club home page Giter Club logo

connect-learndash-discord-addon's Introduction

License

Welcome to the ExpressTech LearnDash Discord Add On GitHub Repository

Create a community of your students by connecting your LearnDash Website to your Discord server. This add-on enables connecting your LearnDash-enabled website to your discord server. With this plugin, you can create a discord community of your students and assign them discord roles in the server according to the course they are learning. private access to course content plus discord's ability to add fun and creativity in community engagement will help create a thriving community, discord is safe and designed to help fight spam and promote healthy community discussions. This plugin promotes Engagement, Upsell and cross-sell opportunities, Advocacy, and referrals that ultimately help increase revenues.

Installation

  • You can find the plugin inside the LearnDash LMS settings Add-ons and click install from there
  • OR Upload the connect-learndash-discord-addon folder to the /wp-content/plugins/ directory.
  • Activate the plugin through the 'Installed Plugins' page in WordPress admin.

Connecting the plugin to your Discord Server.

  • Inside WP Admin, you will find Discord Settings sub-menu under top-level LearnDash menu in the left hand side.
  • Login to your dsicord account and open this url: https://discord.com/developers/applications
  • Click Top right button "New Appliaction", and name your Application.
  • New screen will load, you need to look at left hand side and see "oAuth".
  • See right hand side, you will see "CLIENT ID and CLIENT SECRET" values copy them.
  • Open the discord settings page.
  • Paste the copied ClientID and ClientSecret.
  • Add a Redirect URL, this should be LearnDash Profile of learner.
  • Bot Auth Redirect URL: Add this URL inside Application Redirect settings.
  • Now again see inside discord left hand side menu, you will see "Bot" page link.
  • This is very important, you need to name your bot and click generate, this will generate "Bot Token".
  • Copy the "Bot Token" and paste into "Bot Token" setting of Discord aa-on Plugin.
  • Now the last and most important setting, "Server ID".
    • Enable Developer mode by going into Advanced setting of your account.
    • Then you should right click on your server name and you will see "Copy ID"
    • Copy and paste into "Guild ID" Settings
  • Now you will see "Connect your bot" button on your plugin settings page.
  • Click Connect your bot button and this will take you to the Discord authorisation page.
  • Here you need to select the Server of which Guild ID you just did copy in above steps.
  • Once successfully connect you should see Bot Authorized screen.
  • Open again the discord server settings and see Roles menu.
  • Please make sure your bot role has the highest priority among all other roles in your discord server roles settings otherwise you will see 5000:Missing Access Error in your plugin error logs.

Some features

This plugin provides the following features:

  1. Allow any student to connect their discord account with their LearnDash website account.

  2. Shortcode [learndash_discord] to display connect/disconnect button.

  3. Mapping of courses and discord roles.

  4. Send custom welcome message when student joins the server.

  5. Send custom message when student completes a course.

  6. Send custom message when student completes a lesson.

  7. Send custom message when student completes a topic.

  8. Send custom message when student completes a quiz.

  9. Send custom message when assignment is approved.

Solution of Missing Access Error

  • Inside the log tab you will see "50001:Missing Access", which is happening because the new BOT role need to the TOP priroty among the other roles.
    • The new created BOT will add a ROLE with the same name as it is given to the BOT itself.
  • So, Go inside the "Server Settings" from the TOP left menu.
  • Go inside the "Roles" and Drag and Drop the new BOT over to the TOP all other roles.
  • Do not for forget to save the roles settings

Fequently Asked Questions

  • I'm getting an error in error Log 'Missing Access'
    • Please make sure your bot role has the highest priority among all other roles in your discord server roles settings.
  • Role Settings is not appearing.
    • Clear browser cache, to uninstall and install again.
    • Try the disabling cache
    • Try Disabling other plugins, there may be any conflict with another plugin.
  • Learner are not being added spontaneously.
    • Due to the nature of Discord API, we have to use schedules to precisely control API calls, that why actions are delayed.
  • Learner roles are not being assigned spontaneously.
    • Due to the nature of Discord API, we have to use schedules to precisely control API calls, that why actions are delayed.
  • Some learned are not getting their role and there is no error in the log.
    • It is suggested to TRY again OR use another discord account.

Checkout Our Other Plugins

connect-learndash-discord-addon's People

Contributors

ravisoni6262 avatar younes-dro avatar

Watchers

 avatar  avatar

Forkers

younes-dro

connect-learndash-discord-addon's Issues

fopen performance issue

  • make sure the does not open boolean
  • we have wrap while ( ! feof( $handle ) ) { in if condition like if($handle){ while ( ! feof( $handle ) ) {} }

Learn more Groups and Groups moderator

  • Learndash allows creating groups.
  • Groups can be study groups with a group leader.
  • Discord channels can be created for small study groups and with a leader of the group having a specific role who can manage the group according to the LearnDash settings.

Develop advanced settings tab

  • Welcome message: [CHECKBOX]
    • We can add merge field [LD_COURSES], [LD_STUDENT_NAME], [LD_STUDENT_EMAIL] to append courses name a student to have [TEXTAREA]
  • Course Complete message: [CHECKBOX]
    • Message [TEXTAREA]
      • We can add following merge fields [LD_STUDENT_NAME], [LD_STUDENT_EMAIL], [LD_COURSE_NAME], [LD_COURSE_COMPLETE_DATE]
  • Lesson Complete message: [CHECKBOX]
    • Message [TEXTAREA]
      • We can add following merge fields [LD_STUDENT_NAME], [LD_STUDENT_EMAIL], [LD_LESSON_NAME], [LD_COURSE_LESSON_DATE]
  • Topic Complete message: [CHECKBOX]
    • Message [TEXTAREA]
        • We can add following merge fields [LD_STUDENT_NAME], [LD_STUDENT_EMAIL], [LD_TOPIC_NAME], [LD_COURSE_TOPIC_DATE]
  • Retry Failed API calls: [CHECKBOX]
  • Don't kick students upon disconnect: [CHECKBOX]
  • Log messages: [CHECKBOX]
  • How many times a failed API call should get re-try : [INPUT NUMBER] - set to 5 when the plugin gets activated
  • Set job queue concurrency: [INPUT NUMBER] - set to 1 when the plugin gets activated.
  • Set job queue batch size: [INPUT NUMBER] - set to 6 when the plugin gets activated.
  • Log API calls response (For debugging purposes): [CHECKBOX]

Add documentation tab

Requirements:

  • YouTube video tutorial on how to connect the plugin with discord server Click Here
  • Step-by-Step Written guide on how to connect the plugin with Discord server Click Here
  • Features and other documentation Click Here

WordPress 6.1 Update

Test the plugin with WP 6.1 and update the README.txt and README.md value of "Tested up to:"

Disconnect Discord connection from admin

Requirements:

  • The admin should be able to disconnect a user.

Implementation:

  • Inside admin user listing add a DisConnect button if the member is connected to the Discord server.
  • Inside edit user add a DisConnect button if the member is connected to the Discord server.

Develop connect bot feature

Requirements:

  • We need to develop a Connect Bot feature so users can add BOT to their server.
  • We will follow the same process which we used in memberpress plugin.

Button Designer

Requirements:

  • Add a new TAB Appearance
  • Add input for Connect/Login Button color: - Use WP color picker. Default Color: #7bbc36
  • Add input for Disconnect Button color: - Use WP color picker. Default Color: #ff0000
  • Add input for TEXT over on the Button for logged-in users
  • Add input for TEXT over on the Text on the Button for non-login users
  • Add input for TEXT over on the Text on the Disconnect Button

Develop Course and Role mapping screen

Requirements:

  • We need to Develop a screen where Admin can map the course to the discord roles.

Implementation:

  • Left-hand side Lists the Discord Roles list.
  • Right-hand side List the LearnDash Course.
  • When a student enrolls in a course they will get the role.
  • One role can be mapped to many courses.

Check for Authorised APP

Requirements:

  • It is a case where a user could remove the application from their account and we may lose control of user assignment of role and messages. hence we need to put a check if the application is connected always.

Implementation:

  • We may check every midnight by polling all users and checking if they still have applications in the account.

  • We will notify admin via DM,

    • Message: "Following user {} has removed the application {Application ID} from their account, and the user is removed from the server"
  • -- Update 14 March, 2022 --

  • Even if the student removes the app from authorized apps, the bot can still add/remove roles and members.

Adding a new button under Logs Tab

  • Under the Logs screen add a button for "Scheduled Actions", this button will open the action scheduler page with link:
    • {SITE_URL}/wp-admin/tools.php?page=action-scheduler&status=pending&s=learndash

Under the Role mapping adding a Message

Requirements:

  • Just we had an info message for how to "Drag and Drop" the roles.
  • We have to add a message important to Role Priority inside the Discord server.
  • Message "Make sure the Bot {BOT_NAME} have the high priority than the roles it has to manage." Open Discord Server {LINK}

Implementation

  • First we need to find some API endpint to detect the BOT name using the bot token.
  • {BOT_NAME}, we can save the bot name in option table key --> ets_learndash_discord_connected_bot_name
  • We can display the name of the BOT above the BOT token field.

Send DM about assignment approval of disapproval

Requirements:

  • In the LD there is the ability to allow the student to upload their assignments.
  • The Admin or the group leader can approve or reject an assignment.
  • The Admin and Group leader can assign points to the assignment as well.

Allow non-student settings

  • we need to develop a setting just like allow non-member in membership plugin.
  • when this setting is set to yes,, we will display connect button to normal wordpress site users having learndash account.
  • the users will get default role if selected.

Roles as per the assignment points

Requirements:

  • Students earn points upon uploading assignments that are getting approved by the Group leader or Admin.

Idea:

  • The idea I'm getting is we can assign roles as per the points earned by the students?

Develop advanced settings tab

Requirements:

Disconnect button

  • the disconnect button will kick the student from server.
  • we need to Develop an advanced setting
    • Dont kick students upon disconnect.
      • if this is set to TRUE , we wont kick members on disconnect.

Develop Logs tab

Requirements:

  • Adding a log tab that will contain API log messages.
  • Button to clear Log screen.
  • Button to clear Refresh screen.
  • Button to clear Download Logs.

WP Users listing add column for LearnDash Connect

Requirements:

  • WP users listing add a column name LearnDash Discord
  • The column will have a button RUN API

Implementation:

  • Calling this button will call a method in the Admin class to which will update discord roles in the Discord

Developer Application Details Screen

Requirements

  • This screen should have following inputs.
  • Client ID Input.
  • Client Secret Input.
  • Redirect URL
  • Bot Token
  • Server Id

Implementation:

  • Form should be submitted using the admin post hook.
  • Form must check the nonce value before processing.
  • Server-side validations should be added.
  • JS validations should be added.

Improve Bot Connection JS Code

  • When admin settings load we are checking for response and added few checks, but we can effectively check the return bot_id with the Application Client ID, and when we find a match only then we can confidently say the BOT is connected.

Connect to Discord on checkout

Requirements:

  • We need to add "Login with Discord" button on the checkout page.
  • When students click on this button they will be redirected to discord.com for authentication.
    • Also on this click we will save the current location into the session for use in redirect in later stage.
  • upon redirect from discord, the landing page will be the page that is set in the discord application.
    • Here we will check for current location session storage value and then redirect again to the saved location using wp_safe_redirect()
  • Also, we will check if the email returned from the discord is already exist in the db of the host site.
    • If exists, we will do login user and redirect back to the page saved in the current location session, make sure all the meta keys are saved for the user.
    • If NOT exists, we will create an account for the email and then do login, and redirect back to the page saved in the current location session, make sure all the meta keys are saved for the user.

Display Redirect URL upon clicking the Page Name

Case:-

  • Suppose, I'm setting up the discord application and WordPress plugin side-by-side.
  • When the admin set up the details of the application, at the redirect URL step he could not see Redirect URL until he saves the form.

Implementation:

  • When building the select drop-down input of pages, we can attach the page_url into the option data attribute
  • So when the admin select any page, we will display the data attribute value on top of the input and admin can copy and paste it inside discord.com application settings

Short code for connect discord button

  • we need to develop short code [learndash_discord] which will display a functional connect button.
  • shortcode should display what roles student will get along with default role is selected.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.