public static function does_contact_request_exist(int $userid, int $requesteduserid) : bool {
        global $DB;

        $sql = "SELECT id
                  FROM {message_contact_requests} mcr
                 WHERE (mcr.userid = ? AND mcr.requesteduserid = ?)
                    OR (mcr.userid = ? AND mcr.requesteduserid = ?)";
        return $DB->record_exists_sql($sql, [$userid, $requesteduserid, $requesteduserid, $userid]);
    }
public static function does_contact_request_exist(int $userid, int $requesteduserid) : bool {
        global $DB;

        $sql = "SELECT id
                  FROM {message_contact_requests} mcr
                 WHERE (mcr.userid = ? AND mcr.requesteduserid = ?)
                    OR (mcr.userid = ? AND mcr.requesteduserid = ?)";
        return $DB->record_exists_sql($sql, [$userid, $requesteduserid, $requesteduserid, $userid]);
    }
public static function does_contact_request_exist ( int $ userid , int $ requesteduserid ) : bool { global $ DB ; $ sql = "SELECT id
                  FROM {message_contact_requests} mcr
                 WHERE (mcr.userid = ? AND mcr.requesteduserid = ?)
                    OR (mcr.userid = ? AND mcr.requesteduserid = ?)" ; return $ DB -> record_exists_sql ( $ sql , [ $ userid , $ requesteduserid , $ requesteduserid , $ userid ] ) ; }
Checks if a contact request already exists between users.

@param int $userid The id of the user who is creating the contact request
@param int $requesteduserid The id of the user being requested
@return bool Returns true if a contact request exists, false otherwise
Checks if a contact request already exists between users .