LMS & eLearning

Group Certificates in LearnDash: Award One When Every Course Is Done

How to attach a certificate to a LearnDash group, when the plugin considers the group completed, where the link appears, which shortcodes work on it, and why it can lag behind the last course.

Group Certificates in LearnDash: Award One When Every Course Is Done

A group certificate rewards a learner for finishing a whole programme rather than one course. LearnDash 4.18.0.1 supports it natively: attach a certificate to the group and the plugin issues it when the learner has completed every course in the group. The setup takes a minute. Understanding when the certificate becomes available, and why it sometimes appears later than the learner expects, takes a little longer, so this guide covers both, verified against the group progress functions in the source.

Attach the certificate

Create the certificate first under LearnDash LMS, Certificates, exactly as you would for a course; the certificate from scratch guide covers that. Then edit the group, open the Display and Content Options box and choose the certificate in the Group Certificate dropdown. The value is stored as the group setting certificate. Save, and the group now has a certificate.

Nothing else is required. There is no threshold to set, because a group has no score; completion is the only condition.

When a group counts as completed

Group completion is derived from course activity. The function learndash_get_user_group_progress() loads the group's courses, reads the learner's course activity records for them, and counts a course as completed when its activity row has status set and a completion time. It then calculates a percentage as completed divided by total, rounded up. A group is completed when that percentage reaches the maximum, which learndash_get_user_group_status() reports as the slug completed. The first time the calculation sees every course done it records a group progress activity row with the completion time and fires the group completed action.

Three consequences follow:

  • Every course counts, including ones added later. Attach a new course to the group and every learner's percentage drops until they finish it. The certificate link disappears for them in the meantime, because the status is no longer completed.
  • Courses completed before the learner joined the group count. The check is on course activity, not on when the group membership began.
  • An empty group never completes. With no courses the total is zero and the percentage stays at zero.

The link is produced by learndash_get_group_certificate_link(), which returns an empty string unless the group has a certificate, the certificate post is really a certificate, and the learner's group status is completed. When it returns a URL, it is the certificate permalink with the group ID and a nonce built from the group, the learner and the viewing user, and, when an administrator or group leader is viewing someone else's certificate, a user parameter so they can open it on the learner's behalf. The URL passes through the filter learndash_group_certificate_link before it is returned.

In the LearnDash 3.0 template, the group page prints the certificate as a banner above the group content, with a message telling the learner they have earned a certificate, using the certificate shortcode with the group ID. The same shortcode works anywhere else: [ld_certificate group_id="123" display_as="banner"] on a dashboard page, or the default button form. The learner's profile and the group list do not add a group certificate link of their own, so if you want it somewhere other than the group page, place the shortcode or the Certificate block yourself. Our guide to adding a certificate download button anywhere covers the options.

Content inside a group certificate

The [groupinfo] shortcode is the group counterpart of courseinfo. Useful fields include the group title, the completion date, and the user's name, and they work in both classic certificates and the Certificate Builder, which also has a Group Info block. Course-specific shortcodes have no meaning on a group certificate because there is no single course, so a certificate shared between a course and a group should avoid them or expect blanks. The full list is in the certificate shortcodes reference.

Why the certificate can lag

Group progress is cached in the learner's group progress activity row once it reaches completed, and the calculation also keeps an in-request cache. The percentage is recomputed when progress functions run with the recalc flag, which the completion hooks do when a group course is completed. In practice the certificate appears on the next page load after the final course completes. Two situations break that expectation:

  1. The last course was completed by an admin edit. Marking a course complete from the user profile updates course records but the group row may not be recalculated until the learner next loads a group page or report that forces it. Open the group page as the learner, or view the learner in the Groups administration screen, to trigger it.
  2. Course completion itself is stuck. If a course is stuck short of complete for the learner, the group cannot complete. our guide to course progress that will not reach completion walks through the causes.

Notifying learners

LearnDash sends no email for a group certificate out of the box. The Notifications add-on does not have a group completion trigger either, so the usual approach is a small action on the group completed hook that emails the certificate link, or a line on the group page telling learners to return once every course is done. The group progress functions guide shows the hook and the data it receives.

Course, quiz or group certificate

If you are deciding which object should carry the certificate, the comparison of course, quiz and group certificates lays out the trade-offs. In short, a group certificate is the right tool when the credential is for the programme, learners always take the programme as a set, and you can accept that adding a course later withdraws the certificate until it is completed.

When to get help

Attaching a certificate is a one-minute job. Certificates that must survive courses being added to a programme, dated credentials that expire and require a refresher group, or verification pages for group credentials are development tasks our LearnDash services team handles; a LearnDash developer can also build the completion email that core does not send.

Frequently asked questions

Does the group certificate need a passing score?

No. Groups have no score. The only condition is that every course attached to the group is completed by the learner.

Why did a learner's group certificate disappear?

A course was almost certainly added to the group. Group progress is recalculated against the current course list, so the learner is no longer complete until they finish the new course.

Can an administrator download a learner's group certificate?

Yes. For administrators and group leaders the link includes the learner's user ID, and the certificate page renders it for that user.

Can the same certificate be used for a course and a group?

Yes, but course-specific shortcodes will be blank on the group version. Use groupinfo fields or user fields for anything shared.

Add WorldWin Coder to your preferred sources

Add worldwincoder.com as a preferred source on Google, or open this article in your AI assistant to use it as a source.

· Developers and project managers

Articles written and reviewed by the developers and project managers at WorldWin Coder, who build and maintain websites, web applications and mobile apps on WordPress, Moodle, PHP, Laravel, CodeIgniter and Flutter.

Keep reading

Have something to build, fix or move?

Tell us where you are. A developer reads every inquiry, and you get next steps and a free quote within one business day.