Some people are intolerant of short-chain sugars. They change the osmotic pressure in the gut and can cause diarrhea or constipation or both.
He could try the FODMAP diet and see if it helps.
https://stanfordhealthcare.org/content/dam/SHC/for-patients-component/programs-services/clinical-nutrition-services/docs/pdf-lowfodmapdiet.pdf