Another thing that can really help with constipation is exercise, particularly walking, which helps move things along as you walk plus the gravity factor pulling things downward. I realize not everyone is that mobile, but it does help.
Also on magnesium: if you start to get diarrhea you may be taking too much-although some might view that as a welcome change to constipation