Creating a custom video page for clients

Want to share custom videos with your clients, but they’re all personalized? No problem, with CRM fields it’s possible to show each client exactly what they need to see.

To get the result seen above, you need to:

  • set up CRM fields,

  • create a “videos” page

  • and use if conditions to show the videos.

Setting up the CRM fields

Go to Settings → CRM fields and set up 3 single single line of text fields:

Make sure these fields are not visible in the user profile.

Write down the field IDs as we’ll need them in the next step.

Create a custom videos page

Go to Settings → Templates and click on + Add Page. Name it videos.

Copy the following code into it:

{% extends ajax ? "layout_ajax" : "clients.layout" %}

{% block content %}

	<h1>Videos for you, {{ user.name_f|title}}</h1>

    {% if user.custom_fields.42 or user.custom_fields.43 or user.custom_fields.44 %}
	<div class="container">
  		<div class="row row-cols-3">
            <div class="col">
                <div class="embed-responsive embed-responsive-16by9">
                    <iframe class="embed-responsive-item" src="{{ user.custom_fields.42 }}" allowfullscreen></iframe>
                </div>
            </div>
            <div class="col">
                <div class="embed-responsive embed-responsive-16by9">
                    <iframe class="embed-responsive-item" src="{{ user.custom_fields.43 }}" allowfullscreen></iframe>
                </div>
            </div>
            <div class="col">
                <div class="embed-responsive embed-responsive-16by9">
                    <iframe class="embed-responsive-item" src="{{ user.custom_fields.44 }}" allowfullscreen></iframe>
                </div>
            </div>
  		</div>
	</div>   
    {% endif %}
{% endblock %}

Next, change the user.custom_fields. IDs to those in your CRM fields.

Testing the videos page

Create a test client account, edit it, and enter 3 video URLs in the CRM fields. Make sure that you use embed URLs.

Log in as the client, and visit the custom page https://yourname.spp.io/portal/page/videos to see the videos embedded.

Feel free to set up additional CRM fields if you need more than 3 videos. Make sure to adjust the above template and add more rows to it. Visit the Bootstrap documentation for more information about their grid system.

Adding a videos menu bar item

Go to Settings → Menus and click on + Add link.

Enter the following into the fields:

Click the Save menus button at the bottom of the page.

Setting up a filter for the sidebar

Go to Settings → Templates and open clients/sidebar.twig.

On line 18 you should see: {% for item in items %}

Replace it with:

{% for item in items|filter(item => 
	item.link != '/portal/page/videos' or
	user.custom_fields.42 or user.custom_fields.43 or user.custom_fields.44 )
%}

Unless the video CRM fields are filled out, your client’s won’t see the Videos link in the sidebar.