Aims. A thorough multiwavelength, multiheight study of the vector magnetic field in a compact active region filament (NOAA 10781) on 2005 July 3 and 5 is presented. We suggest an evolutionary scenario for this filament. Methods. Two different inversion codes were used to analyze the full Stokes vectors acquired with the Tenerife Infrared Polarimeter (TIP-II) in a spectral range that comprises the chromospheric He i 10 830 Å multiplet and the photospheric Si i 10 827 Å line. In addition, we used SOHO/MDI magnetograms, as well as BBSO and TRACE images, to study the evolution of the filament and its active region (AR). High-resolution images of the Dutch Open Telescope were also used.Results. An active region filament (formed before our observing run) was detected in the chromospheric helium absorption images on July 3. The chromospheric vector magnetic field in this portion of the filament was strongly sheared (parallel to the filament axis), whereas the photospheric field lines underneath had an inverse polarity configuration. From July 3 to July 5, an opening and closing of the polarities on either side of the polarity inversion line (PIL) was recorded, resembling the recently discovered process of the sliding door effect seen by Hinode. This is confirmed with both TIP-II and SOHO/MDI data. During this time, a newly created region that contained pores and orphan penumbrae at the PIL was observed. On July 5, a normal polarity configuration was inferred from the chromospheric spectra, while strongly sheared field lines aligned with the PIL were found in the photosphere. In this same data set, the spine of the filament is also observed in a different portion of the field of view and is clearly mapped by the silicon line core. Conclusions. The inferred vector magnetic fields of the filament suggest a flux rope topology. Furthermore, the observations indicate that the filament is divided in two parts, one which lies in the chromosphere and another one that stays trapped in the photosphere. Therefore, only the top of the helical structure is seen by the helium lines. The pores and orphan penumbrae at the PIL appear to be the photospheric counterpart of the extremely low-lying filament. We suggest that orphan penumbrae are formed in very narrow PILs of compact ARs and are the photospheric manifestation of flux ropes in the photosphere.