Have control on Download is user logged in and post category



I have Video Pro theme installed and Ultimate Membership Pro. I work fine with this to scripts but I want to customize some stuff.

1.- The Vide Pro theme brings a Video Format post template… this video format post template allows me to specify a download link… after this, a download button will appear at the bottom of the video player… in this case Vimeo videos… I work with Vimeo as a video server. Ok, now my thing… with the membership I can have some plans and some role users… I want that button to show only for members who pay the membership… I know where the code is located but I don’t know what to do next… the membership gives me a shortcode for protect some content… but I know it could be done from PHP code, but I don’t know how… in short terms this is what I want.

is_user_logged_in show button role users: Clients - Admin - Editor

membership level: Free Trial (shows download button except for Premium videos)
Editorial (shows download button of Editorial Videos and shows premium videos with contact button)

Premium (Shows download button to premium videos)

category post: ‘Free Video Post’ (shows button to all users, not logged in and all plans and roles) Free content.

2.- After the download button is set up correctly I want to have a report of the videos that users download… who, when and what… I can put an extra field in the profile section and I want that tab shows the latest videos downloaded from that user.

3.- I have a free video category… I want to show the button to all users included non registered users for this post.

This is the download button code in the video hooks functions php file.

add_filter(‘videopro_singlevideo_right_meta’ , ‘videopro_singlevideo_right_meta_html’, 10, 2);
if(!function_exists(‘videopro_singlevideo_right_meta_html’)) {
function videopro_singlevideo_right_meta_html($html, $post_format) {
if($post_format != ‘video’) return $html;

	$html = '';


	<div class="right">

		<?php do_action('videopro-singlevideo-meta-right-before');

		$download_link = get_post_meta(get_the_ID(), 'video_download_url', true);
		$download_button = get_post_meta(get_the_ID(), 'video_download_button', true);
			<a href="<?php echo $download_link;?>" target="_blank" class="btn btn-default ct-gradient bt-action metadata-font font-size-1"><span><?php echo $download_button ? $download_button : wp_kses(__('<i class="fa fa-cloud-download"></i> Download Video', 'videopro'),array('i'=>array('class'=>array())));?></span></a>