Access WordPress and Moodle with single user credential
Single Sign On for Edwiser Bridge
Current Version 1.3.1
WordPress Version 4.4.2 upto 4.9
Edwiser Bridge Version 1.2.4
WooCommerce Version 2.5.5 upto 3.2
Moodle Version 3.0.3 upto 3.4
PHP version 5.6 upto 7.1
- Single Sign On Installation on WordPress
- License Key Activation on WordPress
- Single Sign On Installation on Moodle
- Single Sign On Extension User Guide
- Social Login Setup
- Google+ Login Setup
- Facebook Login Setup
- User Role Based Redirection
- Single Sign On Shortcodes
- Single Sign On Extension Hooks & Filters
Single Sign On Extension Installation on WordPress
NOTE: Make sure that your PHP is version 5.6 or greater.
- Upon purchasing the Single Sign On Extension for Edwiser Bridge, an email containing the purchase receipt, download links, and license key will be sent to your registered email id. You can download the extensions using the download link provided.
- The email contains the download links for two zip files – ‘edwiser-bridge-sso.zip’ and ‘wdmwpmoodle.zip’.
- The ‘edwiser-bridge-sso.zip’ is the plugin file that has to be installed on the WordPress website.
- To install this plugin, go to the ‘Plugins’ menu from the dashboard.
- Click on the ‘Add New’ button on this page.
- Now click on the ‘Upload Plugin‘ button and upload the ‘edwiser-bridge-sso.zip’ file.
- Click on ‘Install Now’ button once you have located and uploaded the plugin.
- On successful installation click the ‘Activate Plugin’ link to activate the plugin.
- Alternatively, you can unzip and upload the Single Sign On Extension plugin folder using the FTP application of your choice.
License Key Activation
- Once you have activated the plugin go to Edwiser Bridge > Settings > “Licenses” tab.
- A new option labeled as ‘Single Sign On License’ will be created under this tab.
- Enter the license key provided in the purchase email in the ‘License Key’ field and click the ‘Activate License’ button.
- Every license issued is a single site license. You cannot use it on more than one website simultaneously.
- If you need to migrate the plugin from your staging site to your live site you will have to first deactivate license key from the staging site and then use the same key on the live site.
Single Sign On Extension Installation on Moodle
- The ‘wdmwpmoodle.zip’ file will have to be installed on the Moodle website.
- To do so you will have to log in to the Moodle website and navigate to ‘Site Administration’ -> ‘Plugins’ -> ‘Install Plugins’.
- Once here upload the ‘wdmwpmoodle.zip’ file using the ‘Choose a file’ button alongside the ‘Zip package’ field.
- Choose ‘Authentication method (auth)’ from the drop-down list provided against the ‘Plugin type’ field. The ‘Rename the root directory’ field can be left blank.
- Now click the ‘Install plugin from the ZIP file’ button.
- Enable the Single Sign On extension on Moodle by navigating to ‘Site Administration’ -> ‘Plugins‘ -> ‘Authentication’ -> ‘Manage Authentication’ and enable the Edwiser Bridge SSO plugin.
- The last step in the installation process of Single Sign On is adding the “wdm_sso_verify_token” service in your external service. To do so, go to ‘Site Administration’ -> ‘Plugins‘ -> ‘Web Services‘ -> ‘External Services‘. Here, click on the “Functions” button beside the external service which was earlier created for Edwiser Bridge. Click on “Add Functions” and search and add the “wdm_sso_verify_token” service in this list.
Single Sign On Extension User Guide
Defining a Secret Key on WordPress and Moodle
- Once you have installed the extension on WordPress as well as Moodle on both the websites a secret key will have to be set that will facilitate the Single Sign-On process.
- To set the secret key on the WordPress website navigate to ‘Edwiser Bridge‘ -> ‘Settings‘ -> ‘Single Sign On‘ tab from the admin menu and set a secret key of your choice in ‘Secret Key‘ field under the ‘Login Redirect URL‘ field. Save the changes once you are done.
- Now the same secret key should be set on the Moodle website. To set the secret key on Moodle, log in to your Moodle website and navigate to ‘Site Administration‘ -> ‘Plugins‘ -> ‘Authentication‘ -> ‘Edwiser Bridge SSO‘. On clicking ‘Edwiser Bridge SSO‘, the following screen will appear on the right side of your screen.
- Here you will have to enter the same secret key that you entered in the ‘Secret Key‘ field in the Single Sign-On settings on the WordPress website and save the settings.
Including a Login Link on the WordPress Website with a Shortcode
- The Single Sign On extension for Edwiser Bridge allows users to enter their login credentials once in WordPress and be logged in to WordPress and Moodle simultaneously.
- Now it can happen that an end user logs out of the Moodle website. For these users, you can provide a login link on the WordPress website which can be used to automatically login to the Moodle website again without having to enter any login credentials.
- To use the shortcode on your WordPress website create a page and add this shortcode to the page.
- Now use the link of the page that you just created to any menu item that you might want to use to automatically login the user to Moodle and redirect them there.
Setup WordPress log in redirection:
- If you want your users to redirect to Moodle site as soon as they log in from your WordPress site using the WooCommerce My Account login page (www.example.com/my-account), then, go to Edwiser Bridge → Settings → Single Sign On Tab and add your Moodle site’s address or a WordPress page which consists the [wdm_generate_link] shortcode.
Setup Reverse SSO (Automatic login/logout on WordPress site if a User logs in/logs out on Moodle):
- Go to your Moodle site and browse Site Administration → Plugins → Authentication → ‘edwiser bridge sso’. Here, add the complete WordPress site URL in the following section.
Moodle logout Redirection:
- If you want your users to redirection to a certain page after he logs out of Moodle, then please add the logout redirection URL in the following section.
You can enable social login feature in the plugin which empowers your users to register directly on your site by clicking on Facebook or Google+ login button visible on the login/registration page. As soon as they click on either of these buttons, their user account is created on WordPress and Moodle.
PHP Version: Minimum: PHP 5.6+
Recommended: PHP 7.0
Social Login options on login page
In your WordPress backend, browse Edwiser Bridge → Settings → Single Sign On Tab. Here, in the Social Login settings, enable the Google+ login option by checking the box as shown in screenshot below.
When enabled, three additional fields namely Client ID, Client Secret Key, and Application code will be displayed below.
Step 1: Enable Google+ API
- Go to the Google API Console.
- From the project drop-down, select an existing project, or create a new one by selecting Create a new project.
- In the list of services, search and select the Google+ API service. Press the ‘Enable API’ button and wait till it is enabled.
- Now, browse your left hand side menu and select the ‘Credentials’ tab. Under this tab, select OAuth Consent screen tab. Choose an email address, specify a product name and save the changes.
- In the Credentials tab, select the New credentials drop-down list, and choose ‘OAuth client ID’.
- Press the Create button.
- The client ID and Client Secret is now successfully created. Copy and keep this code as backup. Also, copy the application name as well.
- Copy the client ID, Secret Key, and the application name and paste it in the Single Sign On Social Login Settings page and save the changes.
Step 1: Enable Facebook login on your WordPress backend
In your WordPress backend, browse Edwiser Bridge → Settings → Single Sign On Tab. Here, in the Social Login settings, enable the Facebook login option by checking the box as shown in the screenshot below.
Step 2: Create an Application in your Facebook Developer Account
In order to generate application ID and Secret Key, please follow the steps below.
- Log into your Facebook Developer account by clicking here.
- Click on the ‘Create App ID’ in the top right corner of the page.
- Define the name of the application, enter your email address and click on Create App.
Step 3: Register your Product
After creating an application, you will be directed to a page where you can register your product. Here, please follow the steps below.
- In ‘Facebook login’ option, click the ‘Setup’ button
- Choose ‘Web’ as the platform.
- Enter your site URL and click on Save and Continue button.
Step 4: Enter Redirect URI
- Click on the settings link inside the Facebook login Tab on the Left Sidebar.
- Enter the Redirect URI, preferably the link of your homepage.
Step 5: Create an Application in your Facebook Developer Account
To publish this application, click on the App Review Tab on the left sidebar. Now, slide the option to ‘Yes’, choose the appropriate category and click on the ‘Publish’ button.
Step 6: Retrieve App Id and Secret Key
After publishing the app, go to the Dashboard page and retrieve the App ID and the Secret Key.
Copy and paste the App ID and the Secret key in Social Login settings and Save the Changes.
User Role Based Redirection
If you want to redirect users to a specific page based on their role, then browse Edwiser Bridge → Settings → Single Sign On → Redirection and enable the ‘User Role Based Redirection’ option. Select the User Role in the Role Dropdown and enter the URL of the location where you wish to redirect the users with this user role. Click on Add button and Save the changes when done.
|[wdm_generate_link]||Include this shortcode in a WordPress page to redirect a user to Moodle Dashboard when they click on this page’s link.|
|[eb_sso_social_login]||Use this shortcode to add the Facebook and Google social login icons in your login box or a page.|
Hooks and Filters
|eb_sso_login_url||Use this filter to redirect a user to a specific page after logging in to the WordPress website.||$url: URL of th page you want to redirect the user to after logging in to the WordPress website|
|eb_sso_logout_url||Use this filter to redirect a user to a specific page after logging out from the WordPress website.||$url: URL of th page you want to redirect the user to after logging out from the WordPress website|
Last Update on 15th December 2017
= 1.3.1 =
* Fix – Unable to update Secret Key.
= 1.3.0 =
* Feature – Functionality for user role-based redirection.
* Feature – Settings for user role-based redirection enable/disable.
* Feature – Setting for social login enable & disable.
* Feature – Functionality for register and login user using Google plus.
* Feature – Functionality for register and login user using Facebook.
* Feature – Added Shortcode [eb_sso_social_login] to add the social login buttons on any page.
* Tweak – Split the setting into tow parts (Redirection/General) settings.
* Tweak – Split the settings code into tow parts.
* Fix – Reduced the number of request set for the secrete key check.
* Fix – Various performance improvement.
= 1.2.1 =
* Feature – Compatibility with Moodle 3.3 and above.
* Tweak – Single Sign On WordPress settings moved from General Settings to Connection Settings page of Edwiser Bridge plugin.
* Fix – Updated License code.
* Fix – SSO Settings in Moodle plugin not visible on Moodle version 3.3 and above.
= 1.2 =
* Feature – Trigger WordPress login when users logs into moodle.
* Feature – Trigger WordPress logout when users logs out from moodle.
* Feature – Moodle dashboard setting to redirect on a specific page after logout.
* Feature – WordPress dashboard setting to redirect on a specific page after login.
* Feature – Translation ready.
* Feature – Added a button in Dashboard to verify WordPress Secret Key with Moodle Secret Key.
* Tweak – Optimized plugin.
* Tweak – Updated licensing code.
* Tweak – If query argument `redirect_to` or `redirect` is set in login URL, then redirect users to that specified URL.
* Tweak – WooCommerce MyAccount page login – redirect to the same page itself i.e. MyAccount page.
* Fix – Users redirecting to Homepage when they log in on WooCommerce’s checkout page.
* Fix – Notice “undefined constant HTTP_REFERER”
* Fix – Even after saving Secret Key at moodle end, it does not show the entered secret key.
= 1.1.0 =
* Tweak – Single Sign On license key presented inside the “licenses” tab in Edwiser Bridge
* Tweak – Refactored & optimized whole plugin codebase using tools like PHPCS, PHPCBF & PHPMD.
= 1.0.0 =
* Plugin Launched
Frequently Asked Questions
I am Interested in the Single Sign On Extension
The Single Sign On Extension extension requires at least WordPress version 3.0.1 and has been tested up to the version stated under the plugin details.
Single Sign On is an extension of the Edwiser Bridge plugin. Hence, the Edwiser Bridge plugin will have to be installed on your website before you get started. You can download your free copy of Edwiser Bridge from wordpress.org.
I have some license related questions
Every license you purchase is valid for one year, during which you will receive free support and updates. After the license expires you will still be able to use the plugin, but will not receive support or updates. To continue receiving support and updates, you will have to renew the license of the plugin.
The license for the Single Sign On extension is valid only for a single website.
No. The license key that is provided in the purchase receipt is only for the plugin that will be installed on WordPress.
The license is active on the staging site. I now want to activate it on my live site. What should I do?
Each license can be used only on a single website. If you are already using the license on your staging site and want to now use it on your live site, go to Plugins –> Single Sign On License and deactivate the plugin from your staging site. Now use the same license key on your live site.
The license key is associated with the Single Sign-On extension that will be installed on the WordPress website. To enter the license key here you will have to navigate to ‘Plugins‘ -> ‘Single Sign On License‘ in the admin menu of your WordPress website.
Sometimes the license key does not get activated because the ” curl_exec ” PHP file is not enabled in your WordPress. Once you have enabled this file your license key will be activated.
I am Using the Single Sign On Extension
There could be two possible reasons for this to happen:
- You have not set the secret key on WordPress and Moodle: If this is the case then refer to the documentation to learn how to set the secret keys on both websites.
- You do not have the mcrypt extension activated on both WordPress and Moodle: Install and enable mcrypt extension on both websites to resolve this issue.
- The issue could be due to file permissions related to the directory and files in SSO. (Ideally, the “Directory” access permission should be set at 755 and the “Files” access permission should be set at 644)