Now as a sports trainer in a discipline where you can't carry excess weight and have to have good core strength (equestrian) I can be tough on this subject. I've run classes called "Fit to Ride" because you sure as heck can't ride effectively if you're unfit and/or carrying excess weight.
You've said "for some reason you can't shift weight". It's not rocket science. it really is very simply a case of eat less and do more and in the right ratio and proportion. If you're not losing weight then you're eating too much for what you're doing. You've not said what you're eating in terms of calories but you need to know and you need to make sure you're not having too many. Are you having no more than say 1,500 calories daily and are you honest with yourself? Likewise just joining and going to a gym doesn't mean that you're doing sufficient to burn calories. When you're there are you working with a trainer and are you sweating like a pig with your heart pumping. If not you should be.
Likewise you've talked about having history of excessive weight and then massive loss and then large weight gain again. That all indicates to me that rather than this being about a diet and exercise programme that it's about a lifestyle change. Something you can do forever. That allows you to live a well balanced life. Eat normal well balanced menu with portion control and do a lot more moving. It needs to be part of your life.
I'd suggest though that you ask your GP to refer you to a nutriionist or check at that gym if their trainer's are qualified and have done such as Sports Science and Sports Nutrition. If so might well be worth paying for one as a personal trainer to get tough with you. I've never personally been but know a lot who highly recommend the "Weight Watchers" organisation and they also seem to be into "change forever" rather than "diet"