Howto: Restricted custom field access with Pods

Example: Display the description of  videos for everyone, but optionally restrict the acces to the video. 1. define in the Pod videoliste a video custom field (video) and a YEs/NO custom field (free). 2. define a template to list the videos: videotempl (Using Shortcodes in Pods Templates)
[before]
<table class="stripetabelle">
<tr>
	<th>Titel</th>
	<th>Video</th>
</tr>
[/before]
<tr>
	<td>{@post_title}<br/>{@post_content}</td>
	[if free]
	   <td>[video src="{@video._src_relative.medium}"]</td>
	[else]
	   <td>{@video._src_relative.medium,restricted_video}</td>
	[/if]
</tr>
[after]
</table>
[/after]
3. Insert in functions.php the restricted_video function:
function restricted_video($videourl){
	if ( is_user_logged_in() ) {
	   $videobefehl = '<video class="wp-video-shortcode" type="video/mp4" controls="controls"  preload="metadata" style="max-width:100%;" src="'. $videourl . '">Ihr Browser kann dieses Video nicht wiedergeben.</video>';
	 return $videobefehl;
	} else {
	 return "Nur Sichtbar für eingeloggte Benutzer";
	}     	 
}
add_action('init', 'user_eingelogt');
4. Insert in a page the following shortcode:
[pods name="videoliste" template="videotempl" limit="-1" pagination="false"]
5. To avoid that the video is displayed at the front, acivate the „Auto Templates Options“ as follows: Single item view templateName -> videotemplate Single Template Location -> replace
An alternative to the function restricted_video is to use „is_logged_in“ shortcodes from  another plugin or function (see for example https://firstsiteguide.com/show-part-content-logged-users-guests/)