Jump to content

  •  

Important Notification

Members,
For your security and privacy please read this IV News Article to protect your community and your self from IPS. This is urgent and should be taken seriously.
Thank you,
IV Management

- - - - -

4.3 Template Syntax question


  • This topic is locked This topic is locked
1 reply to this topic

#1 theedeer

theedeer

    Newbie

  • Member
  • Pip
  • 1 posts

Posted 10 October 2018 - 01:32 AM

I am trying to add an image if a users contentProfileFields() contains "Leadership", how would I go about checking if contentProfileFields() contains that string within it?

#2 seventeen82

seventeen82

    Advanced Member

  • Donator
  • PipPipPip
  • 70 posts

Donator

Posted 11 October 2018 - 11:09 AM

Where are you trying to display it? If member is a member? Or like for comment author?

Try something like this :
{{$member = \IPS\Member::loggedIn();}}
{{$fieldData = $member->ProfileFields()['core_pfieldgroups_<group_id>']['core_pfield_<field_id>'];}}
{{if $fieldData === 'Leadership'}}
<img>
{{endif}}

Edited by seventeen82, 18 October 2018 - 09:13 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users