Hello and welcome to the WPSecurity101 Dev Blog, where you’ll find updates about what’s happening behind the scenes here at WPSecurity101.
Our big release this week is:
Multiple Currency Support!
Multiple currency support is available now for US clients (rolling out to Europe soon).
If you are in the US, you will be able to purchase in USD, depending on your location. Note that due to the quirks of Canada/US telecoms, some Canadian visitors will also be offered the option to purchase in USD. We’re not really sure how to avoid that, but you can still choose to pay in Canadian dollars.
Assuming everything works as planned, EU support will be coming soon.
Behind the scenes, what is happening is you are being geotargetted by a look-up to the Maxmind GeoIP database by Caddy, our HTTP server. Caddy then adds an x-ipcountry header when it passes the request to PHP and WordPress. This is all seamless and without a third party involved.
We then use that country code to determine whether prices should be displayed in USD or GBP.
One interesting thing is that to help keep maximum capability with existing plugins, we have added a dynamic option. This means if we or a plugin calls:
get_option( ‘lms_product_1_formatted’ );
it would return the price for variant 1 of the course, formatted in the currency expected for that user.
This field doesn’t exist in the wp_options table and is being dynamically generated. Although the original version was straightforward, using tools like GenerateBlocks Dynamic Content seemed like a great idea. However, in practice, it results in a lot of awkward code and caching issues.
We have already written something specific for GenerateBlocks, which will ensure the price is reflected correctly throughout the site.
Other things
We’ve fixed the menu, so when you are logged in, you’ll see the account screen and can access the content. It also prevents you from registering twice, which should avoid any confusion.
We fixed a bad link in the Users module that meant one of the lessons was missing! The lesson was just not obvious.
We added emails! Upon signing up, you now receive an email with a “welcome” message and instructions on what to do next. A similar email is sent for purchases.
Several behind-the-scenes changes have been implemented, including the addition of block visibility by user type. This allows us to set any block to be visible to visitors who are not logged in, to learners, and to learners who have paid. As a result, we can create more advanced layouts and improve overall organisation.
What’s next
We are still hard at work on the organisation/team interface. The Alpha version was clunky for team leads to invite new users, so we’re working hard on a better user experience. However, with several companies waiting to enrol users, this is the development priority for this week.