Been working on getting WPLMS to run on Roots Trellis. It is for a new exciting startup project I have been working on. To quote WPLMS:
WPLMS is a Learning Management System for WordPress . It is suitable for Training Centres, Corporate trainings, Course tutors, College, Academy, University, School and MOOC platform. It is an e Learning WordPress theme for course management, instructor and student management using which you can create and sell your courses online.
Let me show you here you can get it all done smoothly on a Trellis LEMP / Bedrock setup. And with the avoiding of as many mistakes as possible. No need to make the same mistakes I made.
Initial WPML Setup Pains
Have run in quite a few issues. First issue was that importing the dummy data would not go smoothly. This due to quite a few issues, but here then main ones:
- WP Importer interfering with the import and general errors. Had to deactivate it.
- Many deprecated errors running on PHP 7 in the theme
- Quite a few PHP Notices due to undefined indexes or variables. And when you run locally with XDebug turned on like you normally have in Trellis that is a huge pain.
Even after the latest update there were stil some eventOn plugin errors due to using class and function with the same name, but those I did solve.
Today I am going to do it all over again with the latest update. Let’s get started.
NB If you do a clean installation you do not need the next step.
Resetting the Local Setup
To reset the local setup and start all over again without loosing the general setup nor plugins and themes I use the plugin called WordPress Database Reset . Awesome plugin recommended by Arul at Smartpixels. I added it to the composer.json file using this line:
"wpackagist-plugin/wordpress-database-reset":"*"
After that I ran a composer update to update the site plugins and themes in the composer file and to get the WordPress Database Reset plugin:
$ composer update Loading composer repositories with package information Updating dependencies (including require-dev) - Installing wpackagist-plugin/wordpress-database-reset (3.0.2) Downloading: 100% Writing lock file Generating autoload files
Once you installed it you can use it to reset all database tables and restart without the WPLMS theme so you can start anew like you would with a clean installation.
Raising PHP Memory Limit in Trellis
This update should have attended to all these PHP errors and will make debugging a lot easier again. I also raised the memory in trellis/roles/php/main.yml
to 128:
php_memory_limit: 128M
If you don’t it won’t be possibly to install the theme smoothly due to the many components it uses.
Then I removed the theme using:
rm -rf wplms/
Recommended Plugins
NB The installation of most plugins can wait as the theme will ask you for it later on. And this is also recommended by WPLMS. Only if I did not activate the dummy data plugin I could not install with it.
I did add all the necessary plugins and activated them before activating the theme. This as I had them installed before during initial failed attempts. Do not forget to update them when need be! You will see that one plugin eventOn still has errors in file
eventON/includes/class-evo-widget-main.php
But that error you can fix by renaming the functions in question to
__construct()
See PHP 7 deprecated information here.
Dummy Data plugin
Especially the dummy data plugin needs to be active. Otherwise the Theme setup installer will not offer to set up the theme with dummy content. I picked dummy data 2 and installed this plugin.
Plugins in use
Here is a list of plugins I have installed minus WP Job Manager I added later on. The latter is for this project specifically so you do not need it nor every plugin listed here. BackupBuddy is great for backups for example, but not recommended for WPLMS.
BuddyPress does seem to have issues with WPLMS still as I see these errors after I installed all the plugins including BuddyPress
( ! ) Notice: Trying to get property of non-object in /srv/www/domain.com/current/web/app/plugins/vibe-course-module/includes/bp-course-activity.php on line 193 ( ! ) Notice: Trying to get property of non-object in /srv/www/trainerolo.com/current/web/app/plugins/vibe-course-module/includes/bp-course-activity.php on line 199 ( ! ) Warning: Cannot modify header information - headers already sent by (output started at /srv/www/domain.com/current/web/app/plugins/vibe-course-module/includes/bp-course-activity.php:193) in /srv/www/domain.com/current/web/wp/wp-includes/pluggable.php on line 1174
So I initially deactivated it as you will see a little later on.
Theme Installation
Uploading the plugin zip file from appearance > themes with the zipped file had issues too. I got this NGINX error:
413 Request Entity Too Large
Cybercity explains here how you can fix this NGINX limitation. The NGINX config files are Trellis / Ansible managed though so would be could to change the roles, not the config files manually. What I did in the end was simply unzip and add to the themes folder. In your case it should perhaps run just fine and then you can move on and see what I saw in the next step
After uploading the theme folder with all its content it installed just fine. I got to see:
Awesome! After that I was able to install all without issues. Meaning the sample data did get installed this way as well. This did take quite some time though. So do not interfere or freak out because it does not get all done in 10 seconds.
Afterwards you will be asked to make sure your permalinks are correct and that the BP Core Components are installed properly.
BP Core Components Missing
When I went back to the dashboard I did see these errors:
WordPress database error: [Table 'domain_com_development.wp_bp_messages_recipients' doesn't exist] SELECT SUM(unread_count) FROM wp_bp_messages_recipients WHERE user_id = 1 AND is_deleted = 0 AND sender_only = 0 WordPress database error: [Table 'domain_com_development.wp_bp_friends' doesn't exist] SELECT initiator_user_id FROM wp_bp_friends WHERE friend_user_id = 1 AND is_confirmed = 0
This was because the core BP Components were not installed properly yet. The WPLMS installer will ask you to save permalinks and to save the components. It will ask this once the dummy data and theme in general has been installed. Once that is done all is fine and errors will have disappeared.
Revolution Slider Issues
Still after that the homepage looked horrible and I missed the slideshows. When I checked Slider Revolution I saw that I had 4 sliders of which 2 were duplicates. Also the background image for the homepage search slide would not load. By selecting the same dummy image again I was able to bring it back.
Duplicate Pages
Quite a few pages were imported several times somehow. So had to remove quite a few like the Activate or Members page. That shouldn’t really happen now should it? Well, not too hard to take care of this issue though. Just go to the pages list and remove all the duplicates.
Broken Header Due to Old Plugins
Also had an issue with a menu showing up below the main header. List a non styled menu on a white background.
And the header loading the most popular course somehow:
Simply logging out did not hide this type of header so it was not simply a logged in view. I found out later on this was due to me not having updated the plugins that come with the theme. Read my warning above.
NB Most of you will not have had this error either though as you would have the latest plugins of the bat. You will wind up having the pesky notices with the EventOn plugin for which I mentioned a solution earlier
End Result
End result will be a site that is using the dummy data you picked. I picked dummy data 2 and installed the plugin for that. But here are other options. Now you have a great base for your WP Learning Management System.
Main take aways:
- Make sure you have enough RAM for PHP available
- Use the latest theme package
- Install and activate a dummy theme data plugin before activating and configuring theme
Further reading: Vibe Themes WPLMS Documentation