The LearnDash Group Expiration module is part of the Pro Suite of modules for the Uncanny LearnDash Toolkit. It provides a means to expire course access for an entire group and to notify them in advance of the expiration. This is useful when a number of organizations are set up with their own LearnDash Groups and you sell access to courses for a large group over a defined period of time. We see it used most often when organizations pay outside of WordPress for a bulk license to courses.
After turning the module on, there’s a single setting on the LearnDash Toolkit settings page: whether or not to send an expiry email. The content of the email is unique to each LearnDash Group. Note that the timing of the email cannot be changed; it’s always sent 7 days before group expiry to all members of the group.
To set an expiration date and (optionally) an expiration message, navigate to the list of LearnDash Groups in LearnDash LMS > LearnDash Groups. You’ll see that a new column is added for Expiration Date. If access expires in the future, you’ll see an expiry date listed here. If a notification email was sent, this will be listed here as well. If access has already expired, the date and time of expiry is added to the column.
To set or change the expiration date and expiration email, edit a LearnDash Group. When the module is enabled, a metabox for Expiration Date is added to the LearnDash Group page. Click the date field to select an expiration date from the calendar.
The following shortcode outputs the expiration date of the current user’s group:
If the user is in exactly one group with an expiry date set the expiry date of that group will be displayed.
If the user is in more than one group with an expiry date set, the shortcode won’t display anything. For this case, you can manually specify a group ID in the shortcode using the group_id parameter:
to display the expiry date of a specific group.
The shortcode will display the expiry date even if the date has already passed.
Customizing the Notification Email
Beneath the expiration date is an Expiration Email metabox. You can set both the subject line and body for the notification email. In the body of the email, you can include variables for the user’s display name (“%Display Name%”), group name (“%LearnDash Group Name%”) and expiration date (“%Expiration Date%”). Variables are not case sensitive, but we recommend you copy and paste them from the list beneath the body text area. Use the Test Email button to sent a sample expiration email to the site administrator.
- For expiry to take effect, you must set a date in the future. Group courses will be removed at midnight on that date.
- To reactivate an expired group, set a new date in the future.
- The notification email is sent as a cron job, which is only triggered when users visit the site. If no-one visits the site on a date when emails would normally be sent (this is common on development and Staging sites), emails won’t be triggered until someone next visits.