*/ class Wpstream_Admin { /** * Store plugin main class to allow public access. * * @since 20180622 * @var object The main class. */ public $main; /** * The ID of this plugin. * * @since 3.0.1 * @access private * @var string $plugin_name The ID of this plugin. */ private $plugin_name; /** * The version of this plugin. * * @since 3.0.1 * @access private * @var string $version The current version of this plugin. */ private $version; /** * Initialize the class and set its properties. * * @since 3.0.1 * @param string $plugin_name The name of this plugin. * @param string $version The version of this plugin. */ public function __construct( $plugin_name, $version,$plugin_main ) { $this->plugin_name = $plugin_name; $this->version = $version; $this->main = $plugin_main; } /** * Register the stylesheets for the admin area. * * @since 3.0.1 */ public function enqueue_styles() { /** * This function is provided for demonstration purposes only. * * An instance of this class should be passed to the run() function * defined in Wpstream_Loader as all of the hooks are defined * in that particular class. * * The Wpstream_Loader will then create the relationship * between the defined hooks and the functions defined in this * class. */ wp_enqueue_style( 'wpestate-roboto', "https://fonts.googleapis.com/css?family=Roboto:300,400,500,600,700,900&display=swap&subset=latin-ext" ); wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wpstream-admin.css', array(), WPSTREAM_PLUGIN_VERSION, 'all' ); } /** * Register the JavaScript for the admin area. * * @since 3.0.1 */ public function enqueue_scripts() { wp_enqueue_script("jquery-ui-slider"); wp_enqueue_script("jquery-ui-datepicker"); wp_enqueue_script('jquery.fileupload', plugin_dir_url( __FILE__ ) .'js/jquery.fileupload.js',array(), WPSTREAM_PLUGIN_VERSION, true); wp_enqueue_script('wpstream-admin-control', plugin_dir_url( __FILE__ ) .'js/admin_control.js',array(), WPSTREAM_PLUGIN_VERSION, true); wp_localize_script('wpstream-admin-control', 'wpstream_admin_control_vars', array( 'admin_url' => get_admin_url(), 'loading_url' => WPSTREAM_PLUGIN_DIR_URL.'/img/loading.gif', 'download_mess' => esc_html__('Click to download!','wpstream'), 'uploading' => esc_html('We are uploading your file.Do not close this window!','wpstream'), 'upload_complete2' => esc_html('Upload Complete! You can upload another file!','wpstream'), 'not_accepted' => esc_html('The file is not an accepted video format','wpstream'), 'upload_complete' => esc_html('Upload Complete!','wpstream'), 'no_band' => esc_html('Not enough bandwidth.','wpsteam'), 'no_band_no_store' => esc_html('Not enough bandwidth or storage.','wpsteam') )); } /** * Add Plugin Administation menu * * @since 3.0.1 */ public function wpstream_manage_admin_menu() { add_menu_page( __('WpStream','wpestream'), __('WpStream ','wpstream'), 'administrator', 'wpstream_plugin_options', array($this,'wpstream_set_wpstream_credentials') ); add_submenu_page( 'wpstream_plugin_options', __('WpStream Options','wpestream'), __('WpStream Options','wpestream'), 'administrator', 'wpstream_plugin_options', array($this,'wpstream_set_wpstream_credentials') ); add_submenu_page( 'wpstream_plugin_options', __('WpStream Channels','wpestream'), __('WpStream Channels','wpestream'), 'administrator', 'wpstream_new_general_set', array( $this,'wpstream_new_general_set')); add_submenu_page( 'wpstream_plugin_options', __('WpStream Media Management','wpestream'), __('WpStream Media Management','wpestream'), 'administrator', 'wpstream_media_management', array($this,'wpstream_media_management')); } /** * Shows events wpstream * * @since 3.0.1 */ public function wpstream_new_general_set() { $no_channel=1; if(class_exists ('WC_Subscription')){ } //event_passed $args = array( 'posts_per_page' => -1, 'post_type' => 'product', 'post_status' => 'publish', 'meta_query' => array( array( 'key' => 'event_passed', 'value' => 1, 'compare' => '!=', ) ), 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'product_type', 'field' => 'slug', 'terms' => array('live_stream','subscription') ) ), ); $event_list = new WP_Query($args); global $live_event_for_user; $live_event_for_user = $this->main->wpstream_live_connection->wpstream_get_live_event_for_user(); $pack_details = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user(); $this->main->show_user_data($pack_details); if( $event_list->have_posts()){ print '

'.__('Your Pay-Per-View Channel List','wpstream').'

'; $link_new = admin_url('post-new.php?post_type=product').'&new_stream='. rawurlencode('new'); print ''.esc_html__('Create new pay-per-view channel.','wpstream').''; print '
'; print '
'; while ($event_list->have_posts()): $event_list->the_post(); $the_id = get_the_ID(); $is_subscription_live_event = esc_html(get_post_meta($the_id,'_subscript_live_event',true)); $term_list = wp_get_post_terms($the_id, 'product_type'); if( $term_list[0]->name=='subscription' && $is_subscription_live_event=='no'){ continue; } $this->wpstream_live_stream_unit($the_id); endwhile; print'
'; $no_channel=1; }else{ $no_channel=0; } $ajax_nonce = wp_create_nonce( "wpstream_start_event_nonce" ); print ''; $current_user = wp_get_current_user(); $allowded_html = array(); $userID = $current_user->ID; $user_live_streams = get_user_meta($userID,'live_shows'); wp_reset_postdata(); // free $args_free = array( 'posts_per_page' => -1, 'post_type' => 'wpstream_product', 'post_status' => 'publish', 'meta_query' => array( 'relation' => 'AND', array( 'key' => 'wpstream_product_type', 'value' => 1, 'compare' => '==', ), ), ); $event_list_free = new WP_Query($args_free); if( $event_list_free->have_posts()){ print '

'.__('Your Free Channel List','wpestate').'

'; $link_new = admin_url('post-new.php?post_type=wpstream_product'); print ''.esc_html__('Create new free channel.','wpstream').''; print '
'; print '
'; while ($event_list_free->have_posts()): $event_list_free->the_post(); $the_id = get_the_ID(); if( get_post_meta ($the_id,'event_passed',true)!=1){ $this->wpstream_live_stream_unit($the_id); } endwhile; print'
'; $no_channel=1; }else{ $no_channel=0; } if($no_channel==0){ $link_new_paid = admin_url('post-new.php?post_type=product').'&new_stream='. rawurlencode('new'); $link_new_free = admin_url('post-new.php?post_type=wpstream_product'); print '
'.__('* You don\'t have any live channels!','wpstream'); print ''.esc_html__('Add new free channel ','wpstream').''; print ''.esc_html__('Add new pay-per-view channel ','wpstream').''; print '
'; } } // end wpstream_new_general_set /** * Shows event unit card in admin * * @since 3.0.1 */ public function wpstream_live_stream_unit($the_id){ global $live_event_for_user; $live_class=''; if(isset($live_event_for_user[$the_id])) { $live_class=" wpstream_show_started"; } print '
'; $ip= get_post_meta($the_id,'ip',true); if(has_post_thumbnail($the_id)){ $thumb = get_the_post_thumbnail_url($the_id,'thumbnail'); }else{ $thumb= plugin_dir_url( dirname( __FILE__ ) ). 'img/default_150.jpg'; } print '
show_imagge
'; global $wpstream_plugin; $current_user = wp_get_current_user(); // print_R( $wpstream_plugin->wpstream_live_connection->api20_wpstream_get_live_event_for_user($the_id)); // print_R( $wpstream_plugin->wpstream_live_connection->wpstream_request_live_stream_uri($the_id,0,)); print '

'.get_the_title($the_id).' - '.esc_html__('Id','wpstream').': '.$the_id.''.esc_html__('View Channel','wprentals').'

'; $live_event_stream_name = get_post_meta($the_id,'live_event_stream_name',true); $live_event_array = get_post_meta($the_id,'live_event_uri',true); $live_event_uri = ''; $pending_streaming_class = ''; $wpstream_ready_to_stream_class = ''; $external_software_streaming_class = ''; $wpstream_no_stream_class = ''; $carnat_key1 = ''; $carnat_key2 = ''; $uri = ''; $webcaster_url = ''; $rtmp_ip_uri = ''; $uri_ip = ''; $server_id = ''; $obs_uri = ''; $obs_stream = ''; $webCasterUrl = ''; if(is_array($live_event_for_user) && isset($live_event_for_user[$the_id])) { $pending_streaming_class = 'show_stream_data pending_trigger'; $wpstream_ready_to_stream_class = 'hide_stream_data'; $external_software_streaming_class = 'show_stream_data'; $wpstream_no_stream_class = 'hide_stream_data'; if(isset($live_event_for_user[$the_id]['live_uri'])){ $explode = explode('wpstream.net/', $live_event_for_user[$the_id]['live_uri']); $uri = $explode[0].'wpstream.net/wpstream/'; $stream_name = get_post_meta($the_id,'live_event_stream_name',true); $carnat_key1 = $live_event_for_user[$the_id]['carnat1']; $carnat_key2 = $live_event_for_user[$the_id]['carnat2']; $webcaster_url = 'https://'.$live_event_for_user[$the_id]['subdomain_key'].'.live.streamer.wpstream.net:8443/'.$live_event_for_user[$the_id]['carnat2']; $rtmp_ip_uri = 'http://'.$live_event_for_user[$the_id]['ip'].':8444'; $uri_ip= 'rtmp://'.$live_event_for_user[$the_id]['ip'].'/wpstream/'; // starting from 2.0 $server_id = get_post_meta($the_id,'server_id',true); $obs_uri = get_post_meta($the_id,'obs_uri',true); $obs_stream = get_post_meta($the_id,'obs_stream',true); $webCasterUrl= get_post_meta($the_id,'webCasterUrl',true); // if local server id diffrens than wpstream server id it means call was made via api and we use wpstream ip if( $server_id != $live_event_for_user[$the_id]['api20_event_id'] && $live_event_for_user[$the_id]['api20_event_id']!='' ){ $server_id=esc_html($live_event_for_user[$the_id]['api20_event_id']); } } }else{ $pending_streaming_class = 'hide_stream_data'; $wpstream_ready_to_stream_class = 'hide_stream_data'; $external_software_streaming_class = 'hide_stream_data'; $wpstream_no_stream_class = 'show_stream_data'; } print'
'; print'
'.esc_html__('Getting ready to stream. Please wait...','wprentals').' '; print 'loading
'; print '
'.esc_html__('* You can run multiple live events on a single channel. **Once deleted, you can no longer broadcast to it.','wpstream').'
'; print '
'; print '
'; print '
'.esc_html__('Ready To Stream !','wpstream').'
'; print '
'.esc_html__('Start Browser Broadcast','wpstream').'
'; print '
'.esc_html__('Broascast With 3rd Party Software','wpstream').'
'; print '
'.esc_html__('Turn Off Channel','wpstream').'
'; $ajax_nonce_stop = wp_create_nonce( "wpstream_stop_event_nonce" ); print ''; print '
'; print '
'; print '
'.__('Server:').'
' . $obs_uri.'
'.__('copy to clipboard','wpstream').'
'; print '
'.__('Stream Key:').'
'. $obs_stream.'
'.__('copy to clipboard','wpstream').'
'; print '
'. sprintf(esc_html__('Use %s on your Windows or Mac computer, or the Larix Broadcaster app on your %s or %s smartphone/tablet. Various other software and devices are supported, see our %s for details.','wpstream'),'OBS Studio',' iOS','Android','guides').'
'; print ' show_imagge'; print'
'; print'
'; print '
'; print '
'.__('Channel is inactive.','wpestream').' loading
'; print '
Record ? Yes
'; print '
Encrypt ? Yes
'; print ''; print ''; print '
'.esc_html__('* You can run multiple live events on a single channel. **Once deleted, you can no longer broadcast to it.','wpstream').'
'; print '
'; print '
'; print '
'; print '
'; print '
'; print '
'; print '
'; print '
'; print 'Some Facebook Settings for event '.$the_id; print '
'; print '
'; print ''; print ''; print '
'; print '
'; print ''; print ''; print '
'; print '
'; print '
'; print '
'; } /** * Set credential admin function * * @since 3.0.1 */ public function wpstream_set_wpstream_credentials(){ if($_SERVER['REQUEST_METHOD'] === 'POST'){ $allowed_html = array(); $exclude_array = array(); $allowed_html = array(); foreach($_POST as $variable=>$value){ if ($variable!='submit'){ if (!in_array($variable, $exclude_array) ){ update_option( sanitize_key('wpstream_'.$variable), wp_kses ($value,$allowed_html) ); } } } update_option('wp_estate_token_expire',0); update_option('wp_estate_curent_token',' '); delete_transient( 'wpstream_token_request'); } $allowed_html = array(); $api_key = esc_html( get_option('wpstream_api_key','') ); $wpstream_options_array =array( 2 => array( 'label' => 'WpStream.net Username or Email', 'name' => 'api_username', 'type' => 'text', ), 3 => array( 'label' => 'WpStream.net Password', 'name' => 'api_password', 'type' => 'password', ), ); $token = $this->main->wpstream_live_connection->wpstream_get_token(); $pack_details = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user(); $this->main->show_user_data($pack_details); print '
'; print '

'.__('WpStream Credentials','wpstream').'

'; if( get_option('wpstream_api_username')=='' || get_option('wpstream_api_password')== ' '){ echo '
'.__('To connect your plugin, enter your WpStream credentials below or go here to create an account.','wpstream').'
'; }else if($token==''){ echo '
'.__(' Incorrect username or password. Please check your credentials or go here to reset your password.','wpstream').'
'; }else if( $this->main->wpstream_live_connection->wpstream_client_check_api_status() ){ echo '
'.__('Conected to WpStream.net!','wpstream').'
'; }else{ echo '
'.__('Failed to connect to WpStream.net. Please address CURL connectivity with your hosting provider.','wpstream').'
'; } print '
'; foreach ($wpstream_options_array as $key=>$option){ print '
'; $options_value = esc_html( get_option('wpstream_'.$option['name'],'') ); print ''; print ''; print '
'; } print '
'; print ''; print '
'; print '
'; print '
'; $link_new = admin_url('admin.php?page=wpstream_new_general_set'); $link_new_paid = admin_url('post-new.php?post_type=product').'&new_stream='. rawurlencode('new'); $link_new_free = admin_url('post-new.php?post_type=wpstream_product'); print ''.esc_html__('Create new free channel','wpstream').''; print ''.esc_html__('Create pay-per-view channel','wpstream').''; print ''.esc_html('My Channels','wpstream').''; print '
'; } /** * Media Management * * @since 3.0.1 */ public function wpstream_media_management(){ $pack_details = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user(); $this->main->show_user_data($pack_details); print '

'.__('Media Upload','wpstream').'

'.$this->wpstream_present_media_upload().'
'; print '

'.__('Video Management','wpstream').'

'.$this->wpstream_present_file_management().'
'; } /** * Media upload * * @since 3.0.1 */ public function wpstream_present_media_upload(){ $to_return=''; $formInputs=$this->main->wpstream_live_connection->wpstream_get_signed_form_upload_data(); if($formInputs === 'notenough'){ $to_return.='
'.esc_html__('You do not have enough bandwidth or storage to upload a video!','wpstream').'
'; return $to_return; } $to_return.='
'; $to_return.='
'.esc_html__('Please select or drop a video file. Do not close this window during the upload!','wpstream').'
'; $to_return.='
'; $to_return.=''; $to_return.=''; $to_return.='
'; $to_return.='
'.esc_html__('Drop a video file here!','wpstream').'
'; $to_return.='
'.esc_html__('The Video File must be encoded with the following settings: Container: MP4, Video codec: H264, Audio codec: AAC. Media will fail to play back if it does not follow the above settings. You may use a tool like MediaInfo to verify your file. Also you may convert it with specialized software like HandBrake.','wpstream').''.esc_html__('Accepted file extensions: .mp4, .mov .','wpstream').'
'; if(is_array($formInputs)){ foreach ($formInputs as $name => $value) { $to_return.=''; } } $to_return.='
'; $to_return.='
'; return $to_return; } /** * Display movie list * * @since 3.0.1 */ public function wpstream_present_file_management(){ $video_list_raw = $this->main->wpstream_live_connection->wpstream_get_videos_from_storage_raw_data(); $to_return=''; if(is_array($video_list_raw)){ foreach ($video_list_raw as $key =>$video){ $to_return.='
'; $to_return.='
'; $to_return.='
'; $to_return.='
'.esc_html__('File Name :','wpstream').''.''.$video['video_name_storage'].'
'; $to_return.='
'.esc_html__('delete file','wpstream').'
'; $to_return.=''; $to_return.=''.esc_html__('Click to download! The url will work for the next 20 minutes!','wpstream').''; $add_free_video_url=admin_url('post-new.php?post_type=wpstream_product').'&new_video_name='. rawurlencode($video['video_name_storage']); $add_paid_video_url=admin_url('post-new.php?post_type=product').'&new_video_name='. rawurlencode($video['video_name_storage']); $to_return .=''.esc_html__('Create new free VOD from this video').''; $to_return .=''.esc_html__('Create pay-per-view VOD from this video').''; $to_return.='
'; } } else { $to_return.= '
'.esc_html__('You don\'t have any videos.','wpstream').'
'; } return $to_return; } /** * save meta options * * @since 3.0.1 */ public function wpstream_free_product_update_post($post_id,$post){ if(!is_object($post) || !isset($post->post_type)) { return; } if($post->post_type!='wpstream_product'){ return; } $allowed_keys=array( 'wpstream_product_type', 'wpstream_free_video', 'wpstream_free_video_external' ); $allowed_html=array(); foreach ($_POST as $key => $value) { if( !is_array ($value) ){ if (in_array ($key, $allowed_keys)) { $postmeta = wp_kses ( $value,$allowed_html ); update_post_meta($post_id, sanitize_key($key), $postmeta ); } } } } /** * save meta options * * @since 3.0.1 */ public function add_wpstream_product_metaboxes() { add_meta_box( 'add_wpstream_product_metaboxes-sectionid', __( 'Live Channel/Video Settings', 'wpestate' ),array($this,'display_meta_options'),'wpstream_product' ,'normal','default'); } /** * render meta options * * @since 3.0.1 */ public function display_meta_options( $post ) { wp_nonce_field( plugin_basename( __FILE__ ), 'estate_agent_noncename' ); global $post; $is_live = ''; $is_video = ''; $is_video_external = ''; if( isset( $_GET['new_video_name']) && $_GET['new_video_name']!='' ){ $is_video = ' selected '; $wpstream_free_video = esc_html( $_GET['new_video_name']); }else{ $wpstream_product_type = esc_html(get_post_meta($post->ID, 'wpstream_product_type', true)); $wpstream_free_video = esc_html(get_post_meta($post->ID, 'wpstream_free_video', true)); if($wpstream_product_type==1){ $is_live = ' selected '; } if($wpstream_product_type==2){ $is_video = ' selected '; } if($wpstream_product_type==3){ $is_video_external = ' selected '; } } print'


'; print '


'; $wpstream_free_video_external= esc_html(get_post_meta($post->ID, 'wpstream_free_video_external', true)); print '


'.esc_html__('You can choose a video from your computer or use the url from external source or use the url of a YouTube Video or use the url from a Vimeo video.','wpstream').'

'; } /** * Add new product types to Woocommerce select product type * * @since 3.0.1 */ public function wpstream_add_products( $types ){ $types[ 'live_stream' ] = __( 'Live Channel','wpestream' ); $types[ 'video_on_demand' ] = __( 'Video On Demand','wpestream' ); return $types; } /** * Js action to do when user pick live stream or video on demand * * @since 3.0.1 */ public function wpstream_products_custom_js() { if ( 'product' != get_post_type() ) : return; endif; ?> '; woocommerce_wp_select( array( 'id' => '_subscript_live_event', 'label' => __( 'Is a subscription based live channel ?', 'woocommerce' ), 'options' => array("yes"=>"yes","no"=>"no") ) ); echo ''; } echo '
'; echo '
'; $selected=''; if( isset( $_GET['new_video_name']) && $_GET['new_video_name']!='' ){ $selected=esc_html($_GET['new_video_name']); } if($selected==''){ $selected= get_post_meta($post->ID,'_movie_url',true); } woocommerce_wp_select( array( 'id' => '_movie_url', 'label' => __( 'Select the video file.', 'woocommerce' ), 'options' => $this->main->wpstream_live_connection->wpstream_get_videos(), 'selected'=> true, 'value' => $selected ) ); echo '
'; } /** * Save custom fields * * @since 3.0.1 */ public function wpstream_add_custom_general_fields_save( $post_id ){ $permited_values = array( '_movie_url', '_subscript_live_event' ); $allowed_html=array(); foreach($_POST as $key=>$value){ update_post_meta( $post_id, 'event_passed', 0 ); if( in_array($key, $permited_values) ){ if( !empty( $_POST[$key] ) ){ update_post_meta( $post_id, wp_kses ($key,$allowed_html), wp_kses ( $_POST[$key],$allowed_html) ); } } } } /** * Add to cart redirect * * @since 3.0.1 */ public function wpstream_add_to_cart() { wc_get_template( 'single-product/add-to-cart/simple.php' ); } /** * Replace add to cart button * * @since 3.0.1 */ public function replacing_add_to_cart_button( $button, $product ) { global $product; $product_type = $product->get_type(); if($product_type==='live_stream' || $product_type=='video_on_demand'){ return $button = '' . __( 'Add to Cart', 'woocommerce' ) . ''; }else{ return $button; } } /** * Admin notices * * @since 3.0.1 */ public function wpstream_admin_notice() { global $pagenow; global $typenow; if ( !in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { print '

'.__( 'WpStream Pay Per View / Subscription mode works only with WooCommerce - If you want to charge money for your live events or videos you need to activate WooCommerce plugin', 'wpestate' ).'

'; } if( !in_array ('curl', get_loaded_extensions())) { print '

'.__( 'The php CURL library is not enabled on your server. WpStream plugin needs this library in order to work. Please address this issue with your hosting provider.', 'wpestate' ).'

'; } $wpestate_notices = get_option('wp_stream_notices'); if( !is_array($wpestate_notices) || !isset($wpestate_notices['wpstream_update_1021']) || ( isset($wpestate_notices['wpstream_update_1021']) && $wpestate_notices['wpstream_update_1021']!='yes') ){ print '

'.esc_html__( 'New! We just released WpStream WordPress Theme - a turn key solution for video delivery & live streaming. This theme is built around WpStream plugin and is the perfect solution for video streaming or rentals platform. ','wpstream').''.esc_html__('Download Theme','wpstream').'

'; } $ajax_nonce = wp_create_nonce( "wpstream_notice_nonce" ); print ''; } /** * Admin notices * * @since 3.0.1 */ public function wpstream_update_cache_notice(){ //check_ajax_referer( 'wpstream_notice_nonce', 'security' ); $notice_type = esc_html($_POST['notice_type']); $notices = get_option('wp_stream_notices'); if(! is_array($notices) ){ $notices=array(); } $notices[$notice_type]='yes'; update_option('wp_stream_notices',$notices); die(); } /** * Activate metaboxes for Streaming controls on sidebar * * @since 3.0.1 */ public function wpstream_startstreaming_sidebar_meta() { global $post; $term_list = wp_get_post_terms($post->ID, 'product_type'); if( get_post_meta($post->ID, 'wpstream_product_type', true)==1 ){ add_meta_box('wpstream-sidebar-meta', esc_html__('Live Streaming', 'wpstream'), array($this,'wpstream_start_stream_meta'), 'wpstream_product', 'side', 'high'); } $is_subscription_live_event = esc_html(get_post_meta($post->ID,'_subscript_live_event',true)); if(!is_wp_error( $term_list )){ if( isset($term_list[0]->name) ){ if( $term_list[0]->name=='live_stream' || ($term_list[0]->name=='subscription' && $is_subscription_live_event=='yes' ) ){ add_meta_box('wpstream-sidebar-meta', esc_html__('Live Streaming', 'wpstream'), array($this,'wpstream_start_stream_meta'), 'product', 'side', 'high'); } } } } /** * Show Streaming controls on sidebar * * @since 3.0.1 */ public function wpstream_start_stream_meta(){ global $live_event_for_user; global $post; $ajax_nonce = wp_create_nonce( "wpstream_start_event_nonce" ); print ''; $live_event_for_user = $this->main->wpstream_live_connection->api20_wpstream_request_live_stream_for_user(); $this->wpstream_live_stream_unit($post->ID); } }