WordPress.org

Plugin Directory

Easy Digital Downloads HSS Extension for Streaming Video

The easiest and most advanced solution to selling videos with WordPress and EasyDigitalDownloads

  1. Sign up for a free trial account on HostStreamSell.com
  2. Upload, encode, and organize your videos
  3. Install EasyDigitalDownloads and this plugin
    • Go to Settings > HSS Admin and enter API key from your HostStreamSell account and press Save
    • Click the Update key to Pull video information from HostStreamSell platform and insert video all products into the system automatically
    • Go to Videos & Downloads > Settings and then select the Misc tab at the top of the page. Check the box for 'Disable Guest Checkout' and press Save Changes

See https://easydigitaldownloads.com/themes/ for some pre built options for themes specifically designed to work with Easy DigitalDownloads. https://easydigitaldownloads.com/themes/edd-starter-theme/ is a nice free theme which is a good starting point.

Create a page with the [download_history] shortcode if you want customers to be able to see all videos purchased and download a copy. You will place the history-downloads.php template file provided in a directory called edd_templates in your theme directory (rename from history-downloads.php.txt to history-downloads.php).

This plugin requires your customer to register on your website, as their WordPress user ID in your database will be used in our system for adding (and later verifying) access to a video. This requires that they log in every time they come back to your website and want to stream or download their purchased videos. A sample history-downloads.php template file is included with this plugin to allow you easily create a page showing a users purchased videos, links to the videos, and download links (if you have allowed download access). See EasyDigitalDownloads.com for more details on using this template.

Add the following to your template functions.php file to add some extra information on the video page. Feel free to customize this to your needs - that is why it is outside of the main plugin :)

function hss_edd_append_purchase_info_and_links( $download_id ) {
        global $post;
        $video = "";
        if($post->post_type == 'download' && is_singular() && is_main_query())
    {
                if(get_post_meta($post->ID, 'is_streaming_video', true)) {
                        $options = get_option('hss_options');
                        $userId = $user_ID;
                        $hss_video_id = get_post_meta($post->ID,'_edd_video_id', true);

                        $args=array(
                           'meta_key'=> 'is_streaming_video_bundle',
                           'meta_value'=> true,
                           'post_type' => 'download',
                        );
                        _log($args);
                        $my_query = null;
                        $my_query = new WP_Query($args);
                        $groups_found = false;
                        if( $my_query->have_posts() ) {
                                while ( $my_query->have_posts() ) {
                                        $video_group_post =$my_query->next_post();
                                        $bundled_videos =get_post_meta($video_group_post->ID, '_edd_bundled_products', true);
                                        if (in_array($post->ID,$bundled_videos)){
                                                if($groups_found==false){
                                                        $video =$video."<div><BR></div>";
                                                        $video =$video."<div><br>This video can be purchased in the following series:</div>";
                                                        $groups_found=true;
                                                }
                                                $video = $video."<div><a href='".get_permalink($video_group_post)."'>".$video_group_post->post_title."</a></div>";
                                        }
                                }
                                if((!get_post_meta($post->ID,'_edd_hide_purchase_link', true)) and ($groups_found==true))
                                        $video = $video."<BR>This video can bepurchased on its own:";
                                elseif(!get_post_meta($post->ID,'_edd_hide_purchase_link', true))
                                        $video = $video."<BR>Video purchaseoptions:";
                        }
                }
                if(!edd_has_variable_prices($download_id))
                        $video = $video."<BR>".get_post_meta($download_id,'_price_details', true)."<BR>";
                else
                        $video = $video."<BR>";
        }
        if(get_post_meta($post->ID, 'is_streaming_video_bundle', true)) {
                $options = get_option('hss_options');
                $userId = $user_ID;
                $video = "<div>Videos included in this series:</div>";
                $bundled_videos = get_post_meta($post->ID,'_edd_bundled_products', true);
                $count = sizeof($bundled_videos);
                for($counter=0;$counter<$count;$counter++){
                        $vidpost = get_post($bundled_videos[$counter]);
                        $video = $video."<div>- <a href='".get_permalink($bundled_videos[$counter])."'>".$vidpost->post_title."</a></div>";
                }
                $video = $video."<div><BR></div>";
        }

        echo $video;
}
add_action( 'hss_edd_show_video_purchase_details','hss_edd_append_purchase_info_and_links' ,5);

To create a custom receipt which provides links to the videos purchased, use the following code in your functions.php file, and the EasyDigitalDownloads receipt template

function custom_edd_email_tags($message, $payment_data) {
                $downloads = maybe_unserialize($payment_data['downloads']);

                $links = "<ul>";
                foreach($downloads as $download) {

                        if((get_post_meta($download['id'],'is_streaming_video', true)) or (get_post_meta($download['id'],'is_streaming_video_bundle', true))) {
                               $links .= "<li><a href=\"".get_permalink($download['id'])."\">".get_the_title($download['id'])."</a></li>";

                                if(get_post_meta($download['id'],'is_streaming_video_bundle', true)){
                                        $bundled_videos = get_post_meta($download['id'], '_edd_bundled_products', true);
                                        $count = sizeof($bundled_videos);
                                        for($counter=0;$counter<$count;$counter++){
                                                $links .= "<li>- <a href='".get_permalink($bundled_videos[$counter])."'>".get_the_title($bundled_videos[$counter])."</a></li>";
                                        }
                                }
                        }
                }
                $links .= "</ul>";

        $message = str_replace('{list_video_pages}', $links, $message);
        return $message;
}
add_filter('edd_email_template_tags', 'custom_edd_email_tags', 10, 2);
Hi {name},

Thank you for your recent purchase.

You can access your videos with the following link(s):

Note: you need to be logged in to view the full videos

{list_video_pages} 

Price: {price}

Receipt ID: {receipt_id}

Date: {date}

Requires: 3.3 or higher
Compatible up to: 4.0.1
Last Updated: 2015-1-19
Active Installs: 70+

Ratings

5 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.