Students number in instructor profile
-
Dears,
I found a little bug. If I set a fake students number in a course, instructor page shows the real students number.
Thank you
-
Hi Alex,
Thank you for reaching out!
We tested this on our end using the latest official release of LearnPress (version 4.3.2.5). After entering a number in the “Fake Students Enrolled” field within the course settings, we verified that the instructor page correctly displays that number for the specific course.
However, it is important to clarify how this feature works.
The Fake Students feature is designed purely for display purposes at the individual course level to help optimize site performance. Since calculating aggregate totals for an entire instructor profile is resource-intensive, the system does not include these “fake” numbers when calculating the total student count for the instructor’s general profile statistics.
Best regards,
Brianvu-tpOK, so it’s an intentional choice.
From the customers’ perspective, this inconsistency is perceived as a mistake or could cause them to lose confidence in the value of the course.
I switched from a different platform to Learnpress, so I’d like to display the correct number of students I had before.
Should I consider your answer to be the final state of the art?
Thanks
Hi Alex,
Thank you so much for sharing your thoughts!
It works this way because including “fake” numbers in the overall totals affects the logic in many different areas. This includes the statistics charts, the student counts in the dashboard, and even data processing in advanced add-ons like LearnPress – Gradebook. Changing the global calculation could lead to inconsistencies in those reporting tools.
Our development team is going to take a look at how we can possibly include this in a future update. We’re working on finding a way to make this happen that won’t affect the accuracy of the backend reporting and statistics.
For now, the current behavior is the standard logic, but we’re always looking to improve based on user feedback like yours.
Best regards,
Brianvu-tpthank you.
is it possible hiding students number in instructor profile?
Hi Alex,
Thank you for following up!
You can achieve this by adding the following code snippets to your child theme’s functions.php file or by using a plugin like Code Snippets:
1. Hide student count on the Single Instructor profile
This code will remove the student count from the meta information area on the individual instructor’s page:
function lp_child_remove_instructor_count_students( $sections, $instructor ) { if ( isset( $sections['meta'] ) ) { $sections['meta'] = preg_replace( '#<div class="instructor-item-meta"><i class="lp-icon-user-graduate"></i>.*?</div>#s', '', $sections['meta'] ); } return $sections; } add_filter( 'learn-press/single-instructor/info-right/sections', 'lp_child_remove_instructor_count_students', 10, 2 );2. Hide student count on the All Instructors list page
If you also want to remove the total student count from the main directory/list of all instructors, please use this snippet:
function lp_child_remove_list_instructors_total_students( $sections, $instructor, $singleInstructorTemplate ) { if ( isset( $sections['total_students'] ) ) { unset( $sections['total_students'] ); } return $sections; } add_filter( 'learn-press/list-instructors/instructor_item/info/sections', 'lp_child_remove_list_instructors_total_students', 10, 3 );These changes will hide the data from the public view.
Please let us know if the code works as expected!
Best regards,
Brianvu-tpThank you so much for your precious code.
It works as you state, but a little piece missing.
When your show a single course details in page like https://your_site/course/name_of_course and scroll down, there is another instructor box that shows students number again.
Have you some other magic code to fix it?
Thank you
Hi Alex,
We’re glad to hear the previous snippets worked for you!
Depending on whether your theme uses the Classic or Gutenberg/Block structure, use the corresponding code below in your functions.php file.
- For themes using the classic layout:
If your theme follows the traditional LearnPress structure, use this code to remove the student meta from the course item:
function lp_child_remove_course_list_student_meta( $sections, $course, $settings ) {
if ( isset( $sections['student'] ) ) {
unset($sections['student']);
}
return $sections;
}
add_filter( 'learn-press/layout/list-courses/item/section/bottom/end', 'lp_child_remove_course_list_student_meta', 10, 3);2. For themes using Gutenberg (block) layout
function lp_child_hide_course_student_block($block_content, $block) {
return '';
}
add_filter( 'render_block_learnpress/course-student', 'lp_child_hide_course_student_block', 10, 2);3. For the Instructor Block inside the Single Course Page
function lp_child_remove_course_instructor_total_students_meta($sections, $course, $user) {
if ( isset( $sections['meta'] ) ) {
$sections['meta'] = preg_replace(
#<div class="instructor-item-meta">.*?<span class="instructor-total-students">.*?</span>.*?</div>#s,
"
$sections['meta'];
);
}
return $sections;
}
add_filter( 'learn-press/single-course/modern/section-instructor/right', 'lp_child_remove_course_instructor_total_students_meta', 10, 3);Please give these a try. Once added, the student numbers should be completely hidden from all public-facing instructor and course sections.
Best regards,
Brianvu-tpThank you so much … the last function works for me!
Hi Alex,
Thank you for the update!
We’re glad to hear the last function worked perfectly for you.
If you are satisfied with LearnPress and our support, we would greatly appreciate it if you could leave us a 5-star review. Positive feedback motivates us to continue our hard work, and your review is important to us.
Thank you again for your patience and for helping us refine our support process.
Best regards,
Brianvu-tp - For themes using the classic layout:
You must be logged in to reply to this topic.