• Resolved pepe80

    (@pepe80)


    I noticed a problem in the student search on screen:
    Sensei LMS -> Courses -> Manage -> Add Student to Course

    It’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)
  • I’d like to help. I have set up a demo site to test this. On my demo site I have turned off Public student profiles Enable public student profiles that will be accessible to everyone

    (Image link: https://d.pr/i/1ZHFnM )

    I believe this is what you meant when you said you said:

    It’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.

    Then I tested searching by surname:

    (Image link: https://d.pr/i/eIyJIk )

    As you can see, I had no trouble searching. Can you let me know if these are the same steps you’re following or if I did not understand the issue?

    If these are the steps you are following, but you see something differently from me, then I recommend you give the Health Check tool a try to see what the cause could be. The Health Check is a tool that can be useful for debugging, though it requires an official default theme like Twenty Twenty-Four. On the troubleshooting tab, you can click the button to disable all plugins and change the theme for you while you’re logged in to that session, without affecting normal visitors to your site. This will allow you to check what plugins may be contributing to the difficulties you’re having searching.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.