WordPress.org

Ready to get started?Download WordPress

Plugin Directory

Easy Digital Downloads HSS Extension for Streaming Video

Sell access to streaming videos through WordPress by integrating the HostStreamSell video platform with the great EasyDigitalDownloads plugin

  1. Activate the plugin
  2. Go to Settings > HSS Admin and enter API key from your HostStreamSell account
  3. Click the Update key to Pull video information from HostStreamSell platform and insert into the system automatically (also to update)
  4. Go to Videos > 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).

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: 3.9.1
Last Updated: 2014-6-10
Downloads: 1,727

Ratings

5 stars
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.