It is not possible to search for a student by name and surname
-
I noticed a problem in the student search on screen:
Sensei LMS -> Courses -> Manage -> Add Student to CourseIt’s impossible to search for a student by name or surname unless “Display name publicly as: Name Surname” is set on the account edit screen.
I think the problem is in:
/sensei-lms/includes/admin/class-sensei-learner-management.php:711$users_query = new WP_User_Query(
apply_filters(
'sensei_json_search_users_query',
array(
'fields' => 'all',
'orderby' => 'display_name',
'search' => '*' . $term . '*',
'search_columns' => array( 'ID', 'user_login', 'user_email', 'user_nicename', 'user_firstname', 'user_lastname' ),
),
$term
)
);If I’m not mistaken, only the “users” table is searched and the first_name and last_name are in the “usermeta” table. This was missing from the attribute table:
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'first_name',
'value' => $term,
'compare' => 'LIKE'
),
array(
'key' => 'last_name',
'value' => $term,
'compare' => 'LIKE'
)
)
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.