function db_get_user_id_from_cwid

6.x db.inc db_get_user_id_from_cwid($cwid, $type = "faculty")
4.x db.inc db_get_user_id_from_cwid($cwid, $type = "faculty")
5.x db.inc db_get_user_id_from_cwid($cwid, $type = "faculty")
5 calls to db_get_user_id_from_cwid()
user_edit_student_user_form in modules/user/user.student.inc
Let the user edit a studentuser's information.
user_edit_user_advisees_form in modules/user/user.module
This form lets us populate the advisor_student table
user_edit_user_advisees_form_validate in modules/user/user.module
Check to see if we entered a CWID which doesn't exist in students table.
user_edit_user_form in modules/user/user.module
Let the user edit a user's roles and other information.
user_student_edit_student_courses_form in modules/user/user.student.inc
This is the form which we will use to manage a student's courses they've taken.

File

includes/db.inc, line 342
This file contains mostly db shortcuts.

Code

function db_get_user_id_from_cwid($cwid, $type = "faculty") {

  $type_line = " is_faculty='1' ";
  if ($type == "student") {
    $type_line = " is_student='1' ";
  }

  $user_id = db_result(db_query("SELECT user_id FROM users WHERE cwid = '?' AND $type_line ", $cwid));

  if ($user_id) {
    return $user_id;
  }

  return FALSE;

}