Hide the add learner box for non-admin users in Sensei LMS

Hide the add learner box for non-admin users in Sensei LMS on child sites.

Snippet Type

Execute on Child Sites

Snippet

add_action( 'sensei_learners_extra', 'custom_sense_disable_teacher_learner_add', 1 );

function custom_sense_disable_teacher_learner_add ( ){

    // remove the learner add box for teachers
    if( ! current_user_can( 'manage_options' )  ){

        remove_all_actions( 'sensei_learners_extra' );

    }

}