PrettyPixels Posted March 14, 2019 Share Posted March 14, 2019 I'm trying to write a conditional for displaying an IPS database field for logged in members, only. Guests should see an error message asking them to log in or register. The code below is displaying the field to members only, but the error message doesn't display for guests. I can't figure out what I'm doing wrong. Can someone please take a look and point me in the right direction? {{if !\IPS\Member::loggedIn()->member_id}} <div class="error">This is only available to members. Please <a href="/login/">sign in</a> or <a href="/register/">join our community</a> to participate.</div> {{else}} <div class="ipsType_richText ipsType_normal" style="padding: 0 20px;"> {$formValue} </div> {{endif}} Link to comment Share on other sites More sharing options...
opentype Posted March 14, 2019 Share Posted March 14, 2019 Use this code: Link to comment Share on other sites More sharing options...
PrettyPixels Posted March 14, 2019 Author Share Posted March 14, 2019 Thank you, Opentype! 🙂 Very useful. I'm bookmarking it for future reference. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.