• Resolved adcadesigns

    (@adcadesigns)


    Hello,

    I have a live stream product, an ACF with the start and end date field of the live stream.

    I need to compare the start and end date with the current time and hide the live stream player inside the single product if it meets the end date and show a recorded video elementor video widget + acf to pull the dynamic url.

    example:
    live stream start at Sept. 8, 2022 – 12:00 am = js to check the current date if less than or equal to the start date, show live stream, CSS display: block;

    live steam end at Sept 8, 2022 – 11:59 pm = js to check the current date if greater than or equal to the end date, hide the live stream player and show an elementor video widget via CSS display: block;

    of course, this has to also check if the user already bought the item.

    i hope this explains the logic.

    Thank you.

    • This topic was modified 2 years, 2 months ago by adcadesigns.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author wpstream

    (@wpstream)

    Hi there,

    Thanks for your message!

    Unfortunately, I don’t think I’ve fully grasped the idea of what you are trying to achieve. I understand what you want to do – but not the final concept.

    If you could please explain how this logic would work with an example of a page or website that does this, that would be precious information.

    Looking forward to your response!

    Best,
    Beatrice

    Thread Starter adcadesigns

    (@adcadesigns)

    Hello,

    Thank you for getting back with me.

    The idea is since live streams don’t have video recordings after the live event(automatically posted on the single products page that hides the live stream player, just like youtube after you go live, this will generate a copy/recording of the live stream and automatically change the live event to the recording) what I plan to do is to create a date picker to only display elementor video widget based on the end date of the live stream, mostly the following date. here is a screenshot https://prnt.sc/lgxdLHamnvp0 and hidden if the stream start date is still valid.

    To explain further: https://prnt.sc/lgxdLHamnvp0
    1. while the live stream start date(using ACF date picker) is true show the live stream player on a single product page.
    2. if the live stream end date(using ACF date picker) is true hide the live stream player and display the video widget of the uploaded recording of the live stream.
    3. this should only happen if the user bought the pay-per-view.
    4. what we want is to let the user still rewatch the live stream recording after the live event, since they already paid for it. without creating a free VOD page.(we don’t want to let the other users to see this without buying it)

    I’m sorry if my English is not that good, but I hope this will help with the idea.

    Again thank you so much.

    • This reply was modified 2 years, 2 months ago by adcadesigns.
    • This reply was modified 2 years, 2 months ago by adcadesigns.
    Thread Starter adcadesigns

    (@adcadesigns)

    Currently, this is what I have, but it is not working. ??

    add_action( 'woocommerce_before_single_product', 'lws3_user_logged_in_product_already_bought', 30 );
      
    function lws3_user_logged_in_product_already_bought() {
       global $product;
       if ( ! is_user_logged_in() ) return;
       if ( wc_customer_bought_product( '', get_current_user_id(), $product->get_id() ) ) {
          echo '<div>You purchased this in the past.</div>';
    	   
    	   	//start test
    	   $startdate = get_field('live_stream_start_date', false, false);
    	   $enddate = get_field('live_stream_end_date', false, false);
    		// use the same date format for the current date
    		$currentDateTime = date('Ymd');
    	//end test
    	//start test
    		if(strtotime($currentDateTime) >= strtotime($startdate) ) {
    			echo '<style>
    				.wpstream_player_wrapper {
    				display:block;
    			}
    			</style>';
    			echo 'live show';
    		} elseif (strtotime($currentDateTime) <= strtotime($enddate) ){
    			echo '<style>
    				.wpstream_player_wrapper {
    				display:none;
    			}
    			.recorded-video{
    			display:block;
    			}
    			</style>';
    			echo 'recorded show';
    		}
    	   //end test
       }
    }

    thank you.

    • This reply was modified 2 years, 2 months ago by adcadesigns.
    • This reply was modified 2 years, 2 months ago by adcadesigns.
    • This reply was modified 2 years, 2 months ago by adcadesigns.
    Plugin Author wpstream

    (@wpstream)

    Hello there,

    Thank you for providing more information to help us understand your concern. I have forwarded this to Tier 2 support so that they can investigate what can be done.

    We really appreciate your patience with us, and do let us know in the mean time if there are any other questions you have.

    Best,
    Beatrice

    Plugin Author wpstream

    (@wpstream)

    Hi,
    While i think i understand why you are trying to do i do not know if i can offer you a piece of code that while help you.

    What is not working ? Do you see the messages like echo ‘live show’; ? If not print the $startdate = get_field(‘live_stream_start_date’, false, false); and see if you have something saved in there .

    Also for the display if the vod player you could use
    main->wpstream_player->wpstream_video_player_shortcode($product_id);

    I’m sorry i could not help you more.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘ACF date field with live stream single product’ is closed to new replies.