• Welcome to WooUSEFUL by PHPVIBE . Please log in.
avatar_Marius

[ Video Sharing CMS v4 ] Add a download button for stored videos to logged in users

Started by Marius,

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

MariusTopic starter




Step 1: in lib/class.providers.php change :


private function getVideoId($operand, $optionaOperand = null)



to


public function getVideoId($operand, $optionaOperand = null)


Then place in tpl/main/video.php the following code:
<?php if(is_user() && $vid->VideoProvider() == "localfile") { 
$vpath = $vid->getVideoId("localfile/").'@@'.get_option('mediafolder');
$download_link        = site_url() . 'stream.php?file=' . base64_encode(base64_encode($vpath));                  
?>


<a target="_blank" href="<?php echo $download_link; ?>"> Download[/url]




<?php } ?>



This will redirect the user to the hidden path file, for video it force downloads the video, for mp3 it has on click right the "Save video as" option on the generated html5 browser player.
If this helped, consider buying me a coffee.
20 years coding, tweaking, building in PHP. Still creating!
  •  

l1den

pHpVibe:
www.99mega.com
www.90mega.com
www.splatporn.com
  •  

MariusTopic starter

If this helped, consider buying me a coffee.
20 years coding, tweaking, building in PHP. Still creating!
  •  

identicalmedia

  •  

PHPVibe A.


diljigar

Hi Alex,

Can we do it easier when downloading a MP3 file, that not to rename the file from stream.php to  file.mp3 manually? instead download the file.mp3 directly OR rename it automatically.
  •  

PHPVibe A.

You can do

$vpath = get_option('mediafolder').'/'.$vid->getVideoId("localfile/");
$download_link        = site_url() .$vpath;   

identicalmedia

  •  

PHPVibe A.


identicalmedia

  •  

PHPVibe A.


reza

HI
Please re-enter the correct code? Add a download button for stored videos to everyone
I was confused what should I do?
Warm respect
  •  

reza

HI
Please re-enter the correct code? Add a download button for stored videos to everyone
I was confused what should I do?
Warm respect
  •  

PHPVibe A.

It should work, just do an

echo $download_link



or

echo '<a href="'.$download_link.'">Text for download link</a>';


Depends where you want to add it...I can't give you an ultra global solution.

You know any coding?

reza

thanks
i mean the correct code replace under code : (because when download stream.php downloaded)

<?php if(is_user() && $vid->VideoProvider() == "localfile") {
$vpath = $vid->getVideoId("localfile/").'@@'.get_option('mediafolder');
$download_link        = site_url() . 'stream.php?file=' . base64_encode(base64_encode($vpath));                 
?>


<a target="_blank" href="<?php echo $download_link; ?>"> Download[/url]




<?php } ?>
  •  

PHPVibe A.

Well, it does that to protect the link, you have to rename it to something .mp4 :)

Similar topics (7)