Lots of other people have given great suggestions, so I'll just metion somethings that haven't already been metioned.
1. Maybe you should try some nuts like Almonds or Pistacios. It will increase the fiber and provide more magnesium. Also, to get fiber and more magnesium and minerals, you can try sprouted wheat or rye bread.
2. You prob have a parasite problem, which you should address. Pinworms for instance can use up your bodies magnesium stores ( or so I've read ) and hang out in your colon causing mischief.
3. You might try using Magnesium Sulphate or Sienna seed to get things moving again in the short term.