Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • IPS Customization.

    While building this website I have learned a lot about how to customiza different aspects of the IPS products. I see a lot of people struggling to get started with IPS and this section is my attempt to gather what I have learned so others can benefit as well.

    To me nothing is more important than to share knowledge and help others. This section contain my findings and the things I have learned, but I still have much more to learn as well. Together we can learn and evolve the ways we customize the IPS products and while doing that there are no stupid questions. In the forum you can ask any question and we will try our best to answer them.

    Go to the IPS Forum ->
  • Show entry only to people set using the Member custom field


    Jimi Wikman
     Share

    If you want a way to set who can see a specific entry where you need to be able to choose individuals rather than user groups, then this is how you can do that.

    First you need to add the custom field called "Member" to your database. This will allow you to select users, and you can set the field to allow one user or multiple users.

    In your template we can then use the common logic check found in the IPS guide:

    {{if in_array( member.member_id, array( 5, 28, 472 ) )}}
    	<!-- Shows if the member's ID is 5, 28 or 472 -->
    {{endif}}

    When we use the Member field we first need to ensure that we get the raw values that is the ID. This will give us a list of ID's that are separated by spaces. We will use implode and preg_split to change that into a useable comma separated list. Finally we change the code to use explode instead or array to get things working the way we want. The result looks like this:
     

    {{$ids = $record->customFieldDisplayByKey('member', 'raw');}}
    {{$list = implode(", ", preg_split("/[\s]+/", $ids));}}
    
    {{if in_array( member.member_id, explode(", ",$list) ) }}
    PLACE YOUR CONTENT HERE
    {{endif}}

     

     Share


    User Feedback

    Recommended Comments

    There are no comments to display.



    Please sign in to comment

    You will be able to leave a comment after signing in



    Sign In Now

×
×
  • Create New...