Professional Documents
Culture Documents
Note: Extreme scroll of death ahead! You may wish to download this post as a PDF file from here.
You can also immediately head down to the bottom of this post for a Scribd embed version of this
super-long post.
How would you like to be able to launch into a Wordpress blog directly from within your Moodle
production site? At the end of this post, you will know how to enable a Single Sign-On between
your Moodle 2.9 site and your Wordpress multisite in a LAMPP environment. To put it simply,
within Moodle itself, you will be able to launch into Wordpress directly using the same Moodle
login details. For example, here I am at my Moodle 2.9 test page, before clicking on the External
Tool activity:
After clicking "Da Store" activity, I am transported into my WordPress page. The Wordpress site
can open up either as an embed or as a separate window.
Notice the same login details above? The Single-Sign On (SSO) is part of a bigger picture called
LTI (Learning Tools Interoperability). For a layman's explanation, head over to Quora. Gavin
Hendrick has some super organised thoughts on LTI in his blog post.
In this post, I am going to show all the steps needed to do this.
The 10 steps are divided into 3 phases:
Section I: Newbies section (skip this and go Click here if you already know this)
1. Create a MySQL database
2. Create a MySQL user to link to the database
3. Download and install Wordpress
Section II: Multisite Wordpress Section
4. Setup Wordpress as a multisite
Section III: The LTI Connector Section
5. Download and install SPV's LTI Connector for WordPress
6. Modify wp-config.php for WordPress to allow Tool Consumers to be saved
7. Add a Tool Consumer record
Section IV: The Moodle Section
8. Creating a Moodle LTI external tool type
9. Adding an LTI external tool on your Moodle coursepage
10. Testing the fruit of your labours - it works!
Section I: Newbies section (skip this and go here if you already know
this)
1. Create a MySQL database
Log into your CPanel.
Enter your database name. Mine will be frankie_wrdprss. Yours may differ. Click "Next Step".
Enter the name of the username that will be used to access the MySQL database. My username will
be frankie_wrdprss. Type in the password twice. Choose a password that consists of letter, numbers
and special characters. Click the "Create user" button.
At the user's privileges window, tick the "ALL PRIVILEGES" checkbox. Click "Next Step" button.
If all went well, you should see a 'success' window. This concludes Part 1.
If you are using a Windows server, click the download Wordpress 4.2.2 button. If that button now
reads as 5.x.x, then you will know how outdated this post is, LOL! If you are using a LAMPP
(Linux) system, click the https://wordpress.org/latest.tar.gz
Go back to your CPanel.
Type the text "blogwp" as the folder name and click the "Create New Folder" button.
Refresh your screen (usually F5). You should see the new blogwp folder in the list.
Double-click your mouse on the blogwp folder. The directory is empty. You are now ready to
upload the Wordpress compressed file either by FTP or by the CPanel's File Manager.
Extract the file's contents. A new subfolder named Wordpress will be created,
Click the Close button. Next make sure you move the contents of /public_html/blogwp/wordpress
into /public_html/blogwp:
10
You can then delete the (by then) empty wordpress subfolder. Your /public_html/blogwp folder
should look like this:
Choose your language (English (United States) is the default) and click the "Continue" button.
11
You will see the above window. Remember the database name, username and username's password
that you had created earlier?
12
Click the Submit button. If the details were entered correctly, you will be prompted with the
following screen:
13
Click the "Run the install" button. The "Information needed" window will appear. Type in your
blog's title and the administrator user's login details. For example:
Important! Use DIFFERENT sets of admin username and password for your Moodle admin
account and your Wordpress admin account. Please choose separate admin usernames and separate
passwords to avoid any complications during the sign-on from Moodle to Wordpress.
Click the "Install Wordpress" button to initiate the installation of Wordpress. If successful, you
should see the following window:
14
Enter your Username and Password. Click the "Log in" button.
If your Wordpress 4.2.2 site has been successfully setup, you should see this screen:
Congratulations! You are now ready to go to Steps 4 through to 9. Stay logged into your Wordpress
site. Do not log out yet.
15
16
If you check your Wordpress left menu, you should see options available under "Tools".
Refresh your web browser. If you check your Wordpress left menu, you should see an additional
option named 'Network Setup' available under "Tools":
17
Click the Network Setup link. You should now see this screen:
18
Be careful to replace the highlighted code with your own domain name and folder name.
Edit the file named /public_html/blogwp/.htaccess and replace the highlighted section
19
<== Careful!!
%{REQUEST_FILENAME} -f [OR]
%{REQUEST_FILENAME} -d
^ - [L]
^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2
^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
. index.php [L]
Again, be careful to replace the above yellow highlighted code with your own folder name.
So your .htaccess file should now look like this:
Save both wp-config.php and .htaccess files. Log out of Wordpress. Log in again.
20
In addition, if you hover your mouse cursor over "My Sites" you will see a new option "Network
Admin" with its own set of options (Dashboard, Sites, Users,...etc.).
21
Extract the zip file to your harddrive. The contents of the zip file look like this:
22
Upload the subfolder lti into the plugins directory of the WordPress instance. I.e.,
into /public_html/blogwp/wp-content/plugins
Your plugins folder should now look like this:
23
Check the LTI tickbox and then click LTI's "Network Activate" link to activate the plugin.
24
Once enabled, the module will automatically create a set of tables in the WordPress database and a
new menu option named "LTI Tool Consumers" will appear on the dashboard menu.
If you need to completely remove the LTI plugin from your WordPress installation, delete
the public_html/blogwp/wp-content/plugins/lti subfolder and
use phpMyAdmin to remove the database tables using the following SQL:
DROP
DROP
DROP
DROP
DROP
TABLE
TABLE
TABLE
TABLE
TABLE
wp_lti_user;
wp_lti_nonce;
wp_lti_share_key;
wp_lti_context;
wp_lti_consumer;
25
Here's what that 'defines' part of /public_html/blogwp/wp-config.php looks like, after the addition:
26
27
Click the "LTI Tool Consumers" link. You will see an empty list of Tool consumers. To add a Tool
Consumer, click the "Add New" button.
28
Type in "blogs" as the Name. Tick the "Accept launch requests for this tool consumer" check box.
Tick the "Resource: Prefix the ID with the consumer key and resource link ID" radio button.
29
Click the "Add Tool Consumer" button to save the tool entry. Wordpress will display the Launch
URL, the (Consumer's) Key and the Secret (Key) codes. You should copy and paste these values
into a text editor like Notepad.
30
Clicking again on the LTI Tool Consumers link will give you the list of Tool Consumers created so
far:
31
32
Click the "Add external tool configuration". Enter the following details:
Tool name: blog
Tool base URL: http://www.yourdomain.com/blogwp/?lti
33
As shown below:
Under the Privacy section, set "Accept grades from the tool" to Never.
34
Click the "Save changes" button. You will see you entry saved and appear as below:
35
Click the "Save and return to course" button. You will see your External Tool activity on your
course page.
36
37
In this example, I am logged in as CEFL WP Admin in both Moodle and Wordpress. Success!
38
In this example, I am logged in as Alex The Lion in both Moodle and Wordpress. Success!
39
In conclusion, the SSO between Moodle and Wordpress works. I hope this is useful for you and
that you have saved a lot of hours by reading this post. If you are also have managed to successfully
use Simon Booth's LTI Connector plugin for your own production or test site, please drop in a
comment. I would love to hear from you.
Cheers
Frankie Kam, Malaysia
APPENDIX
Some afterthoughts. Still can't work?
(1) Did you replace the your own correct domain name and folder name inside wp-config.php?
(2) Did you replace the your own correct folder name inside .htaccess?
(3) Make sure that your Wordpress admin account's username and password are different from your
Moodle site's admin account.
(4) Double check the contents of .htaccess and wp-config.php.
(5) Perhaps you didn't upload the lti folder into the plugins folder of Wordpress.
(6) Maybe you don't have mod_rewrite enabled on your Apache web server. Read here.
(7) The LTI Consumer Tool doesn't save the record to the list after clicking "Add New"? Read here.
(8) Send me an E-mail: boonsengkam at gmail dot com.
Useful References:
Using WordPress Multisite: A Network of Websites at Your Fingertips
http://code.tutsplus.com/articles/using-wordpress-multisite-a-network-of-websites-at-yourfingertips--wp-23978
LTI Connector for WordPress Homepage
http://www.spvsoftwareproducts.com/php/wordpress-lti/
Projects Oscelot Org's plugin page
http://projects.oscelot.org/gf/project/wordpress-lti/frs/?action=FrsReleaseView&release_id=918
Direct download of LTI plugin used in this post
http://projects.oscelot.org/gf/download/frsrelease/918/5837/wordpress-lti-1.1.00.zip
Solving the "No Tool Consumers Saved When Added" problem
http://projects.oscelot.org/gf/project/wordpresslti/forum/?action=ForumBrowse&_forum_action=MessageReply&message_id=1761
Review: LTI Provider for Moodle 2.2
http://www.somerandomthoughts.com/blog/2012/01/08/review-lti-provider-for-moodle-2-2/
My outdated blog 2013 post on the same subject
http://moodurian.blogspot.com/2013/07/integrating-moodle-and-wordpress.html
40