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")
22 calls to db_get_user_id_from_cwid()
calendar_appointment_content_form_validate in modules/calendar/calendar.module
Custom validate handler for when we save an appointment form. We want to confirm the student is valid, and also store ONLY the cwid.
calendar_confirm_cancel_appointment_form_submit in modules/calendar/calendar.module
calendar_display_schedule_staff_page in modules/calendar/calendar.module
This page (primarily meant for students) is for quickly finding your advisor or professor or whomever, and finding their link to schedule an appointment with them.
calendar_find_and_remind_notify_upcoming_appointments in modules/calendar/calendar.module
This function will find appointments approaching within X number of minutes, and send out notifications to all involved.
calendar_get_appointments_for_faculty in modules/calendar/calendar.module
Return back a list of appointment content nodes for this faculty member, which fall between the specified datetimes.

... See full list

File

includes/db.inc, line 537
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;

}