Hooks & Developer Reference
The plugin’s extension surface is (1) the filters it provides, (2) subclassing the abstract module to add an LMS, (3) overriding its templates from your theme, and (4) the PeepSo and WordPress hooks it consumes plus the one Groups action it fires. Everything below is drawn from the source.
Filters this plugin provides
Section titled “Filters this plugin provides”| Filter | Default | Purpose |
|---|---|---|
peepso_lms_courses_per_page |
12 |
Page size for the Courses / Instructing / Assignments profile lists. Return an integer. |
peepso_lms_assignments_visible |
own profile only | ( bool $visible, int $user_id ) - who may see a member’s Assignments tab. Return true to open it to other viewers. |
peepso_lms_activity_dedupe_window |
5 minutes | ( int $seconds, string $type ) - the window in which a repeated milestone is suppressed as a duplicate. |
// Show 24 course cards per page instead of 12.add_filter( 'peepso_lms_courses_per_page', fn() => 24 );PeepSo hooks consumed
Section titled “PeepSo hooks consumed”The plugin integrates by hooking PeepSo core and PeepSo Groups filters/actions:
| Hook | Type | Purpose |
|---|---|---|
peepso_init |
action | Registers the plugin template directory with PeepSo’s template stack. |
peepso_navigation_profile |
filter | Adds the Courses / Certificates / Instructing / Assignments profile tabs. |
peepso_rewrite_profile_pages |
filter | Registers the tab slugs as profile sub-pages so they resolve on pretty permalinks. |
peepso_profile_navigation_{courses-slug} |
filter | Adds the All / In Progress / Completed sub-nav on the Courses tab. |
peepso_profile_segment_{courses-slug} |
action | Renders the Courses tab body. |
peepso_profile_segment_achievements |
action | Renders the Certificates tab body (segment slug stays achievements). |
peepso_profile_segment_instructing |
action | Renders the Instructing tab body. |
peepso_profile_segment_assignments |
action | Renders the Assignments tab body. |
peepso_activity_types |
filter | Registers the plugin’s activity types. |
peepso_activity_stream_action_icon |
filter | Supplies the stream icon for LMS activities. |
peepso_activity_content_before |
filter | Resolves {user} / {course_name} / {lesson_name} / {quiz_name} tokens at render time. |
peepso_activity_post_attachment |
action | Attaches the compact course card beneath an LMS activity. |
peepso_profile_preferences |
filter | Adds the per-member “Learning Activity” opt-out toggles. |
peepso_admin_config_tabs |
filter | Adds the LMS tab to PeepSo Configuration. |
The {courses-slug} segment defaults to courses and is admin-configurable
(lms_navigation_profile_slug).
Groups action fired
Section titled “Groups action fired”When a course has a Default activity group, the plugin stamps the activity
post with peepso_group_id and fires the PeepSo Groups action so the item renders
in the group stream:
do_action( 'peepso_groups_new_post', $group_id, $post_id );WordPress hooks used
Section titled “WordPress hooks used”Standard WordPress hooks the plugin registers: plugins_loaded (bootstrap at
priority 20), init (textdomain), wp_enqueue_scripts / admin_enqueue_scripts,
admin_menu, admin_notices, add_meta_boxes and save_post (course-group
metabox), widgets_init (course-groups widget), plus the activation/deactivation
hooks. Each LMS module additionally hooks its own platform’s enrollment,
completion, lesson, and quiz events inside register_activity_hooks().
Template overrides
Section titled “Template overrides”Profile tab templates render through PeepSo’s template stack, so a theme can
override them. Copy any file from the plugin’s templates/ folder into your theme
under peepso/:
wp-content/themes/<theme>/peepso/profile/courses.phpwp-content/themes/<theme>/peepso/profile/achievements.phpwp-content/themes/<theme>/peepso/profile/instructing.phpwp-content/themes/<theme>/peepso/profile/assignments.phpThe plugin registers its own directory via PeepSoTemplate::add_template_directory()
on peepso_init, and PeepSo resolves the theme copy first.
Adding a new LMS
Section titled “Adding a new LMS”Every LMS is a module extending PeepSo_LMS_Abstract. To add one:
- Create
classes/modules/class-lms-<id>.phpwith a classPeepSo_LMS_<Name>. - Implement the abstract methods:
get_id(),get_name(),is_active(),get_user_courses(),get_course_progress(),get_user_certificates(),get_user_quizzes(),register_activity_hooks(),get_activity_types(),get_course_post_type(). - Declare optional capabilities by overriding
supports( $feature )for any of:certificates,quizzes,assignments,instructor,enrollment. Tabs and behavior gate on these. - In
register_activity_hooks(), hook your platform’s events and route them through the shared helpers on the abstract:track_activity( $user_id, $type, $message, $external_id, $extra )- posts to the stream after checking the site toggle, the per-member opt-out, and de-duplication.build_activity_message( $type )- returns the tokenized template, applying any admin action-text override.handle_enrollment( $user_id, $course_id )- runs auto-join for linked groups.
- Register the module in
PeepSo_LMS::load_modules()/register_modules().
Activity $type values are lms_enroll, lms_complete, lms_lesson,
lms_quiz_pass, lms_quiz_fail, lms_certificate, lms_achievement. Pass the
course as $external_id for course-level activities, or in $extra['course_id']
for lesson/quiz activities so it still mirrors into the course’s activity group.
Public API
Section titled “Public API”$lms = PeepSo_LMS::get_instance();
$lms->get_active_modules(); // active PeepSo_LMS_Abstract[]$lms->get_module( 'learndash' ); // one module or null$lms->is_module_active( 'tutor' ); // bool$lms->get_setting( $key, $default ); // reads the PeepSo config store$lms->is_activity_type_enabled( 'enroll' ); // site-level toggle$lms->get_user_courses( $user_id ); // grouped by LMS$lms->get_user_certificates( $user_id ); // grouped by LMS$lms->get_user_instructing_courses( $user_id );$lms->get_user_assignments( $user_id );
// Course-to-group API (only when the Groups addon is active):$lms->groups->get_course_groups( $course_id, 'related' ); // 'related'|'autojoin'|'activity'|null$lms->groups->set_course_groups( $provider_id, $course_id, $group_ids, $link_type );$lms->groups->get_activity_group( $course_id );Per-member sharing preference: PeepSo_LMS_Profile_Settings::user_shares( $user_id, $suffix ).
Data storage
Section titled “Data storage”| Store | Name | Notes |
|---|---|---|
| Custom table | {prefix}peepso_lms_course_group |
Course-to-group links: provider_id, course_id, group_id, link_type. Indexed on course, group, and link type. |
| Settings | PeepSo config store (PeepSoConfigSectionLMS) |
All lms_* settings. Seeded/migrated on first load. |
| Post meta | is_peepso_lms_activity, peepso_lms_activity_info |
Flag + stored entity ids on each LMS activity post. |
| Post meta | peepso_group_id |
Set on an activity post mirrored into a group. |
| User meta | peepso_lms_{type}_{external_id} |
De-duplication marker per milestone. |
| User meta | peepso_lms_activity_{suffix}_enable |
Per-member opt-out (opt-out model: unset means shared). |
| Options | peepso_lms_settings_migrated, peepso_lms_groups_db_version |
One-time migration flags. |
Constants
Section titled “Constants”| Constant | Value |
|---|---|
PEEPSO_LMS_VERSION |
2.0.0 |
PEEPSO_LMS_MODULE_ID |
7000 (activity module id) |
PEEPSO_LMS_FILE / PEEPSO_LMS_PATH / PEEPSO_LMS_URL |
Plugin file, path, URL |

