Complex sentence: Opioids have agonist actions on the intestinal opioid receptors, which when activated cause constipation, drugs such as morphine or codeine can be used to relief of diarrhea this way.
Split into simpler sentences: Opioids have agonist actions on the intestinal opioid receptors, which when activated cause constipation. Drugs such as morphine or codeine can be used to relieve diarrhea this way.