First, whatever you plug into the rear GREEN "speaker" jack will be detected as "speakers". It doesn't know the difference between a headset and and speaker - just that a device is plugged into it and it assumes it's speakers. The same way with the front Headphone jack. Whatever is plugged in there - headphones or analog speakers it will still be detected as "headphones"
Since it worked once, except for the crackling noise whatever "fiddling around" you did seems to have corrrupted it. Uninstall the RealTek in the Device Manager (do not uninstall the drivers
) and then restart the PC and when Windows starts it should detect and reinstall the sound. This may reset it and get things back to the way it was. If that doesn't fix it, reinstall the latest RealTek drivers for your specific system. If you have a "name brand" computer, such as a Dell in many cases non-Dell drivers do not work or work correctly.
If you get it back to everything working, then you can work on the cracking noise. There are several issues, the first one would be to reseat the audio cable from the front panel to the motherboard audio connection. If that does not fix it, there are many posts about "popping and crackling" in audio and it can happen with any sound device including SoundBlasters, RealTek, IDT (SigmaTel), etc. Some general issues that seem to affect this is wi-fi, video card/drivers, cordless phones or cell phones placed close to the PC. There can be other issues, but this is a starting point.