Customize Pay Per View Plugin

I have a theme that loads videos directly from the database, not the post. I need to protect that content… I tried to follow the “customization Help” but am not a programmer, and ended up with a “500 Server Error” when I added the code to functions.php

The template code that needs to be protected is this:

<?php dp_video($post->ID, get_option(‘dp_single_video_autoplay’:wink:); ?>

I know it is a lot to ask, but could you tell me what code I need to add to protect the video please?

  • aecnu
    • WP Unicorn

    Greetings oljej,

    Welcome to WPMU Dev!

    Thank you for the great question and even though custom coding is beyond the scope of the support we provide here, we do try to help if we can.

    With that said, we probably need a copy of the theme to figure it out. However, I will not make that decision, we will leave that up to the lead developer @hakan to decide.

    Therefore I will see if I can get the lead developer in here with his invaluable insight into this plugin for his advice/advise for us.

    Though this may take a bit longer then a normal ticket, I will try to get him in here asap.

    Cheers, Joe

  • oljej
    • Flash Drive

    Thank you soo much… I am sure it will be an easy fix for someone that knows what they are doing. I am a couple steps closer now (I’m no longer getting the server errors and have it putting the buttons next to the video). But still can’t get it to “block” the video with my particular theme. I hope we can get something worked out because the theme is EXACTLY

  • aecnu
    • WP Unicorn

    Greetings oljej,

    No problem and we will indeed help you if we can.

    I still believe we will need a copy of the theme for Hakan to check out and test, but as I mentioned before I shall pass that authority over to Hakan to decide.

    Thank you for you additional input and happy to see that you are moving forward though we still have the original issue to deal with.

    Cheers, Joe

  • oljej
    • Flash Drive

    Not to be antsy, but is it going to be a matter of hours, days, or weeks before the developer can jump in? Just so I can tell how to proceed.

    I have now found that the theme code that actually creates the html to display the videos is located in the theme’s functions.php file – still plugging away, but might have to head a different direction if it is going to take too long to get figured out. Again I am not trying to be pushy, just might have to find a different solution if it is going to take too long (I understand this is not your fault).

  • aecnu
    • WP Unicorn

    Greetings oljej,

    Thank you for this great legitimate concern.

    This particular lead developer is very timely and responsive and I anticipate that you will hear from him tomorrow since it is currently in the middle of the night in his location.

    Cheers, Joe

  • oljej
    • Flash Drive

    For the developer when he’s able to look at this… I would prefer to block the entire post – I have no need for an excerpt. Not sure if that will help you steer me in the right direction, but thinking it might, so wanted to throw it out there.

  • oljej
    • Flash Drive
    function dp_video($post_id, $autoplay = false) {
    $file = get_post_meta($post_id, 'dp_video_file', true);
    $file = !empty($file) ? explode("n", $file) : array();
    $url = trim(get_post_meta($post_id, 'dp_video_url', true));
    $code = trim(get_post_meta($post_id, 'dp_video_code', true));

    if(!empty($code)) {
    $code = do_shortcode($code);
    if(function_exists('jwplayer_tag_callback'))
    $code = jwplayer_tag_callback($code);
    $code = extend_video_html($code, $autoplay);

    echo '<div class="video-wrap">'.$code.'</div>';
    } elseif(!empty($url)) {
    $url = trim($url);
    global $wp_embed;
    $wp_embed->post_ID = $post_id;
    $video = $wp_embed->autoembed($url);
    if(trim($video) == $url) {
    $wp_embed->usecache = false;
    $video = $wp_embed->autoembed($url);
    }

    $video = extend_video_html($video, $autoplay);

    echo '<div class="video-wrap">'.$video.'</div>';
    } elseif(!empty($file)) {
    $video_width = 950;
    $video_height = absint($video_width*(9/16));

    $poster = get_post_meta($post_id, 'dp_video_poster', true);
    if(empty($poster) && has_post_thumbnail($post_id) && $thumb = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'custom-large'))
    $poster = $thumb[0];

    echo '<div class="video-wrap">';
    dp_jplayer(array(
    'files' => $file,
    'poster' => $poster,
    'width' => $video_width,
    'height' => $video_height,
    'type' => 'video',
    'autoplay' => $autoplay
    ));
    echo '</div>';
    }
    }

  • aecnu
    • WP Unicorn

    Greetings oljej and Hakan,

    Thank you Hakan for quickly popping in here and letting us know about this coding issue which prevents us from using the Pay Per View plugin as desired. Of course no doubt the theme developer will claim this is unintended use and probably will not be interested in re-coding this portion of the theme – or at least not for free.

    @oljej Sorry that we could not be of further assistance to get this issue resolved but as Hakan has clearly pointed out it is a coding issue preventing proper intended use of the Pay Per View plugin and not the plugin itself. But he has indeed pointed us in the right direction to getting this resolved in any event.

    Thank you for being a WPMU Dev Community Member!

    Cheers, Joe

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.