One thing LearnDash cannot do out of the box is sell access to Groups via WooCommerce.
A Group in LearnDash, amongst other things, let’s you assign a group of courses to a group of users. You can add courses over time and those users will automatically get access.
To do this I setup a new Group in LearnDash called “Master Course” and added my new smaller courses to it. I also created a new WooCommerce Virtual Product called “Master Course.”
Then I simply added this code to my functions.php:
Here is what this code does:
- Hook into WooCommerce when an order is marked complete
- Checks to see if that order includes my Master Course WooCommerce product
- If so, it adds that user who purchased the product to my LearnDash group
It’s pretty simple and shows the power of hooks in WordPress.
To customize this for your own use you would have to add the Group and Product IDs to the corresponding variables on line 5 and 7.
One thing this doesn’t do is remove a person from a group if they cancel or are refunded the order, since this is something I wanted to do manually. However, you could easily do this by hooking into the woocommerce_order_status_cancelled or woocommerce_order_status_refunded hooks.
A big thanks to Justin from LearnDash and Ernest from UncannyOwl, who is working on a plugin that will also allow for this functionality.
I’m very excited to be back at a WordCamp in Baltimore, a town I love. Today I am speaking on PHP for WordPress, a topic near and dear to my heart since I learned PHP via WordPress and, as a teacher, guide others on this path as well.
After you check out the slide notes, please check out the Trailer for my PHP for WordPress Course from Treehouse.
I was very happy to attend WordCamp Philly this weekend. Please enjoy the slides from the talk (some of them had embedded video, which is unfortunately not present).
I have taken off a number of months in 2015 from speaking at WordCamps, but I’m excited to announce that I’ll be speaking at WordCamp Philly (June 13-14).
My talk will be about WordPress hooks, actions and filters. This is something I tried to talk on last year, but have learned a lot more in how to present this content since then and am excited for a much smoother and comprehensive talk with a sexy slide deck to boot 🙂
I have been a big Gravity Forms supporter for a long time, however, I’m beginning to get more interested in Ninja Forms, which is a free WordPress form builder and also quite powerful.
If you decide to build your WP forms with Ninja Forms, you may find the ninja_forms_display_form() function helpful since it let’s you hardcode a form directly into a template.
Most of the time I add my forms as shortcodes, but on occassion it’s necessary to hardcode in the form to the theme files itself. Here’s the full documentation for the ninja_forms_display_form hook.
Shout out to Tom for posting this article on “Understanding Events, Actions, and Filters” as part of the WPTuts “Using WordPress for Web Application Development” series.
If you’re new to WordPress plugin development, you definitely want to review this article.
I figure by this point all the hype for WP 3.7 has died down. So now we can get into the practical uses of some of the new dev features like the date query.