• Resolved grantcause

    (@grantcause)


    So with 3.3.0 we get to embed videos into our Course Catalog which I was really looking forward to using.

    Unfortunately after upgrading to 3.3.0 I started to get a Fatal Error on my Course Catalog and Membership Catalog. The only displayed the title and no courses or memberships.

    I had a number of style and functions.php changes in a Child Theme created from the Divi theme so I backed these out one at a time and no difference.

    I then disabled plugins one at a time and no difference.

    I then investigated the problem in the file mentioned in the fatal error:
    /wp-content/plugins/lifterlms/templates/loop/featured-img.php line 18

    I tracked the problem down to the use of the empty() function in php.
    Prior to PHP 5.5, empty() only supports variables and anything else will result in a parse error.

    I am a programmer so I modified the following code:

    
    // short circuit if the featured video tile option is enabled for a course
    if ( 'course' === $post->post_type ) {
    	$course = llms_get_post( $post );
    // Note: The following line was giving a Fatal Error. Prior to PHP 5.5, empty() only supports variables anything else will result in a parse error.
    //	if ( 'yes' === $course->get( 'tile_featured_video' ) && ! empty( $course->get( 'video_embed' ) ) ) {
    //		return;
    //	}
            $tile_featured_video = trim(llms_get_post( $post )->get( 'tile_featured_video' ));
            $video_embed = trim(llms_get_post( $post )->get( 'video_embed' )); 
    	if ( 'yes' === $tile_featured_video && !empty( $video_embed ) ) {
    		return;
    	}
    }
    

    My Course and Membership catalogs are now working again and I can now embed videos just fine.

    Although I wish they didn’t make use of the wp_ombed_get functionality in the get_video() function in the course model and allowed us to just embed the video via the raw iframe code that YouTube supplies for that purpose.

    I modify the youtube parameters in the iframe code so that I can get the videos to display the way I want on my course. Like this:

    
    <iframe src="https://www.youtube.com/embed/[my_videos_youtube_code_goes_here]?modestbranding=1;&rel=0;&frameborder=0" width="560" height="315" allowfullscreen="allowfullscreen"></iframe>
    

    So unfortunately I wont be using the videos on my course catalog.

    My setup is as follows:
    Version: 3.3.0
    Db Version: 3.3.0
    Php Version: 5.4.35
    Mysql Version: 5.5.52

    Hope this helps someone else with this problem in the future.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘3.3.0 upgrade – Fatal error: Can’t use function return value in write context in’ is closed to new replies.