Sort users in alphabetical order in Course – Admin area

1. Go to WP Admin -> Plugins -> editor -> WPLMS Customizer -> customizer_class.php
2. Add the following code in __construct function :

PHP Code:

add_filter('wplms_course_status_filters',array($this,'wplms_course_status_filters'));
add_filter('wplms_sort_by_status_query',array($this,'sort_alphabetical'),10,4);

3. Add these functions in the class :

PHP Code:

function wplms_course_status_filters($args){
                $args[10]=__('Alphabetical','vibe');
                return $args;
            }
 
            function sort_alphabetical($course_id,$status,$page_num,$loop_number){
                if($status == 10){
                    global $wpdb;
                    $cquery=$wpdb->prepare("SELECT DISTINCT a.user_id FROM {$wpdb->usermeta} a INNER JOIN {$wpdb->users} b ON a.user_id = b.ID WHERE a.meta_key = %s ORDER BY b.display_name  ASC LIMIT %d, %d",'course_status'.$course_id,$page_num,$loop_number);
                }
                return $cquery;
            }