function course_enrolment_check in Course 6
Check if the user has enrolled in a course.
Parameters
mixed $nid: A course node ID.
mixed $uid: A user ID.
Return value
bool TRUE if the user is enrolled, FALSE otherwise.
3 calls to course_enrolment_check()
- CourseObject::access in includes/
course_object.core.inc - Access functionality for course objects.
- course_enrol in ./
course.module - Enrols a user in a course.
- _course_enrollment_create in services/
course_enrollment_resource.inc - Create an enrollment.
File
- ./
course.module, line 1111 - course.module Core functionality for Courses.
Code
function course_enrolment_check($nid, $uid) {
$sql_check = "SELECT 1 FROM {course_enrolment} WHERE nid = %d AND uid = %d AND status = %d";
$query = db_query($sql_check, $nid, $uid, 1);
return db_result($query) > 0;
}