Site News #11: Content gating changes, More Systems Ruby

Hi there graceful devs, here’s what’s new!

Content Updates

More Systems Ruby: I did some poking around in the archives, and was reminded of some more content that belongs in the Systems Ruby course. There’s now a 7-part section on working efficiently with Ruby’s low-level file I/O APIs, using a reimplementation of the UNIX tail command as an example. I’d totally forgotten about that series, and I’m excited to highlight it in this way. Not only will you learn more about file I/O, but you’ll see an example of iteratively encapsulating procedural code into OO abstractions.

Feature Updates

New content-gating behavior

My philosophy for building Graceful.Dev has been to leverage off-the-shelf code for 99% of the solution, and write the 1% of customization and glue code that makes it work “just right”. Towards that end, the site is build on a foundation of WordPress, the LearnDash Learning Management System plugin, and a symbiotic combination of WP Fusion and MemberPress for managing memberships and content access.

One area where this has fallen slightly short of “just right” is in how LearnDash handles attempts to read course topics when you don’t have access (either because you’re logged-out, or because you don’t have the right course product or membership). By default, you get redirected to the course home page.

That’s not the experience I want. If someone follows a link to a Graceful.Dev topic (either from a third-party site, or from being redirected from the old RubyTapas site), I want it to behave like the RubyTapas site did: show an excerpt, and a note about how to get access (register, log in, join, etc.).

Anyway, long story short, I’ve added some customizations to the site to make it do just that: now if you don’t have access to a piece of content, you’ll see an excerpt and a notification about how to get access. This is a step toward my long-term goal of retiring content from the RubyTapas site: it enables the old episodes to redirect directly to their corresponding Graceful.Dev topics.

New Pro membership behavior

I’m still getting the hang of how to code “with the grain” of this tech stack. Originally, the way Pro membership worked was there was a group of “premium” courses that you’d get automatically enrolled in when you joined. Maintaining this course-group was a bit of a hassle, though, and a few thousand callbacks would get fired every time a new course was added to that group.

More recently, I made some changes so that Pro members could self-enroll in premium courses. This didn’t pan out as well as I’d expected, however; it confused several users and could make it look like you’d lost your course progress. It also turned out to have some hinky edge-cases, because it was effectively routing around how LearnDash normally thinks about course access.

So, after some more research, I’ve once again made a change to how Pro membership works. It now uses a built-in LearnDash feature called “auto-enrollment”. If you’re a Pro member (either directly or through a RubyTapas legacy account) you will once again be considered by the system to be enrolled in all courses. I no longer have to maintain a fixed list of “pro courses”, however. And staying “with the grain” means even less customization code to maintain.

Sorry about any confusion along the way!

Video script and code now in tabs

I’ve reworked the “video script and code” to make better use of the site theme and show that content in a tab, instead of behind a fold-out at the bottom of the post.

Fixed some styling regressions

A major version update to the LearnDash plugin introduced some visual regressions with the site’s theme. Since the update didn’t add any features or fixes I needed, I’ve downgraded it back to the 3.x series until theme support catches up.

A faster site

Cloudways hosting continues to pay off in terms of making it very easy (and relatively inexpensive) to experiment with different instance sizes and compare performance. After some experimentation I’ve bumped up the server instance size again and upped request memory limits. I’m seeing a more responsive site as a result and hopefully you will too.

That’s it for this edition. Stay graceful!

— Avdi