• Resolved speedysweedy

    (@speedysweedy)


    Ever since we upgraded our PODS to 2.8x, the media player to play the mp3 file is no longer showing for previously entered content and thus, nobody can listen to recorded sermons.

    Further, any new content that is added using the PODS extended content to attach media to a message, the media file is not saved when we publish the page

    I’ve tried editing my PODS and simply re-saved them in an effort to re-write them but that didn’t work.

    The page I need help with: [log in to see the link]

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Scott Kingsley Clark

    (@sc0ttkclark)

    How is your “Message Audio” embedded? Do you use a pod template there with magic tags? Or is this a shortcode or something else?

    Thread Starter speedysweedy

    (@speedysweedy)

    I didn’t build this site, I’m just the silly one who volunteered to try to fix it. The builder of the site is MIA – When I look at the PODS Admin, I don’t see any PODS Templates defined so I’m going to assume it uses a shortcode somehow.

    Plugin Author Scott Kingsley Clark

    (@sc0ttkclark)

    Looks like there’s a site error happening there, can you try turning on WP_DEBUG by following the instructions here: https://wordpress.org/support/article/debugging-in-wordpress/

    Let me know what error messages you see on the page when you go there.

    Thread Starter speedysweedy

    (@speedysweedy)

    Oh man, I’m getting lots of errors now. BTW, thank you so very much for helping me with this! You’re very much appreciated!

    The specific page error you’ve asked for is

    Fatal error: Uncaught Error: Undefined constant “guid” in /home/waverley/public_html/wp-content/themes/waverly/single-message.php:133 Stack trace: #0 /home/waverley/public_html/wp-includes/template-loader.php(106): include() #1 /home/waverley/public_html/wp-blog-header.php(19): require_once(‘/home/waverley/…’) #2 /home/waverley/public_html/index.php(17): require(‘/home/waverley/…’) #3 {main} thrown in /home/waverley/public_html/wp-content/themes/waverly/single-message.php on line 133

    Plugin Author Scott Kingsley Clark

    (@sc0ttkclark)

    Now we know where the error happens, can you provide any of the code from your file at:

    wp-content/themes/waverly/single-message.php

    Thread Starter speedysweedy

    (@speedysweedy)

    Here is the code from single-message.php

    <?php
    
    get_header();
    
    $show_default_title = get_post_meta( get_the_ID(), '_et_pb_show_title', true );
    
    $is_page_builder_used = et_pb_is_pagebuilder_used( get_the_ID() );
    
    //dcrosbie - get parent post info
    $post_parent_id = wp_get_post_parent_id( $post_ID );
    
    ?>
    
    <div id="main-content">
    	<div class="container">
    		<div id="content-area" class="clearfix">
    			<div id="left-area">
    			<?php 
    				
    			//dcrosbie show parent post info
    			if ($post_parent_id > 0) {
    				echo get_the_post_thumbnail($post_parent_id, 'full' );
    			}
    				
    			while ( have_posts() ) : the_post(); ?>
    				<?php if (et_get_option('divi_integration_single_top') <> '' && et_get_option('divi_integrate_singletop_enable') == 'on') echo(et_get_option('divi_integration_single_top')); ?>
    
    				<?php
    					$et_pb_has_comments_module = has_shortcode( get_the_content(), 'et_pb_comments' );
    					$additional_class = $et_pb_has_comments_module ? ' et_pb_no_comments_section' : '';
    				?>
    
    				<article id="post-<?php the_ID(); ?>" <?php post_class( 'et_pb_post' . $additional_class ); ?>>
    					<?php if ( ( 'off' !== $show_default_title && $is_page_builder_used ) || ! $is_page_builder_used ) { ?>
    						<div class="et_post_meta_wrapper">
    							<h1 class="entry-title"><?php the_title(); ?></h1>
    
    						<?php
    							if ( ! post_password_required() ) :
    
    								et_divi_post_meta();?>
                                    Pastor: <?php the_terms( get_the_ID(), 'pastor'); ?>
    								<?php //dcrosbie - show parent post sermon
    								if ($post_parent_id > 0) {
    									$parent_permalink = get_site_url() . "/message/?post_parent=" . (string) $post_parent_id;
    									echo "<br/><br/><strong>Sermon Series: </strong><a href='" . $parent_permalink . "'>" .get_the_title($post_parent_id) . "</a>";
    								}?>
                                <br/><strong>Sermon Topics:</strong> <?php the_terms( get_the_ID(), 'sermon_topic'); ?> 
    								<?php $thumb = '';
    
    								$width = (int) apply_filters( 'et_pb_index_blog_image_width', 1080 );
    
    								$height = (int) apply_filters( 'et_pb_index_blog_image_height', 675 );
    								$classtext = 'et_featured_image';
    								$titletext = get_the_title();
    								$thumbnail = get_thumbnail( $width, $height, $classtext, $titletext, $titletext, false, 'Blogimage' );
    								$thumb = $thumbnail["thumb"];
    
    								$post_format = et_pb_post_format();
    
    								if ( 'video' === $post_format && false !== ( $first_video = et_get_first_video() ) ) {
    									printf(
    										'<div class="et_main_video_container">
    											%1$s
    										</div>',
    										$first_video
    									);
    								} else if ( ! in_array( $post_format, array( 'gallery', 'link', 'quote' ) ) && 'on' === et_get_option( 'divi_thumbnails', 'on' ) && '' !== $thumb ) {
    									//dcrosbie print_thumbnail( $thumb, $thumbnail["use_timthumb"], $titletext, $width, $height );
    								} else if ( 'gallery' === $post_format ) {
    									et_pb_gallery_images();
    								}
    							?>
    
    							<?php
    								$text_color_class = et_divi_get_post_text_color();
    
    								$inline_style = et_divi_get_post_bg_inline_style();
    
    								switch ( $post_format ) {
    									case 'audio' :
    										printf(
    											'<div class="et_audio_content%1$s"%2$s>
    												%3$s
    											</div>',
    											esc_attr( $text_color_class ),
    											$inline_style,
    											et_pb_get_audio_player()
    										);
    
    										break;
    									case 'quote' :
    										printf(
    											'<div class="et_quote_content%2$s"%3$s>
    												%1$s
    											</div> <!-- .et_quote_content -->',
    											et_get_blockquote_in_content(),
    											esc_attr( $text_color_class ),
    											$inline_style
    										);
    
    										break;
    									case 'link' :
    										printf(
    											'<div class="et_link_content%3$s"%4$s>
    												<a href="%1$s" class="et_link_main_url">%2$s</a>
    											</div> <!-- .et_link_content -->',
    											esc_url( et_get_link_url() ),
    											esc_html( et_get_link_url() ),
    											esc_attr( $text_color_class ),
    											$inline_style
    										);
    
    										break;
    								}
    
    							endif;
    						?>
    					</div> <!-- .et_post_meta_wrapper -->
    				<?php  } ?>
    
    					<div class="entry-content">
    					<?php
    						do_action( 'et_before_content' );
    
    						the_content();
                            
                            echo 'Key Verse(s): ' . get_post_meta(get_the_ID(), 'bible_verse', TRUE);
                            
                            echo '<br/>Message Audio: ';
                            $audio_info = get_post_meta(get_the_ID(), 'message_audio', TRUE);
                            if ($audio_info) {
                                echo do_shortcode('[audio src="' . $audio_info[guid] . '"]');
    							echo '<a href=' . $audio_info[guid] . ' download>Download</a>';
                            }
                            //var_dump(get_post_meta(get_the_ID(), 'message_audio', TRUE));
    
    						wp_link_pages( array( 'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'Divi' ), 'after' => '</div>' ) );
    					?>
    					</div> <!-- .entry-content -->
    					<div class="et_post_meta_wrapper">
    					<?php
    					if ( et_get_option('divi_468_enable') == 'on' ){
    						echo '<div class="et-single-post-ad">';
    						if ( et_get_option('divi_468_adsense') <> '' ) echo( et_get_option('divi_468_adsense') );
    						else { ?>
    							<a href="<?php echo esc_url(et_get_option('divi_468_url')); ?>"><img src="<?php echo esc_attr(et_get_option('divi_468_image')); ?>" alt="468" class="foursixeight" /></a>
    				<?php 	}
    						echo '</div> <!-- .et-single-post-ad -->';
    					}
    				?>
    
    					<?php if (et_get_option('divi_integration_single_bottom') <> '' && et_get_option('divi_integrate_singlebottom_enable') == 'on') echo(et_get_option('divi_integration_single_bottom')); ?>
    
    					<?php
    						if ( ( comments_open() || get_comments_number() ) && 'on' == et_get_option( 'divi_show_postcomments', 'on' ) && ! $et_pb_has_comments_module ) {
    							comments_template( '', true );
    						}
    					?>
    					</div> <!-- .et_post_meta_wrapper -->
    				</article> <!-- .et_pb_post -->
    
    			<?php endwhile; ?>
    			</div> <!-- #left-area -->
    
    			<?php get_sidebar(); ?>
    		</div> <!-- #content-area -->
    	</div> <!-- .container -->
    </div> <!-- #main-content -->
    
    <?php get_footer(); ?>
    Plugin Author Scott Kingsley Clark

    (@sc0ttkclark)

    In you code, where you see:

    
                            $audio_info = get_post_meta(get_the_ID(), 'message_audio', TRUE);
                            if ($audio_info) {
                                echo do_shortcode('[audio src="' . $audio_info[guid] . '"]');
    							echo '<a href=' . $audio_info[guid] . ' download>Download</a>';
                            }
    

    Replace that with:

    
                            $audio_info = get_post_meta(get_the_ID(), 'message_audio', TRUE);
                            if ($audio_info) {
                                echo do_shortcode('[audio src="' . esc_attr( $audio_info['guid'] ) . '"]');
    							echo '<a href="' . esc_url( $audio_info['guid'] ) . '" class="download">Download</a>';
                            }
    

    I wonder if your site was running an older version of PHP that allowed the old code to work or if something else changed on the site beyond just updating Pods?

    Thread Starter speedysweedy

    (@speedysweedy)

    I thought I would look into the PHP version a little before I changed the code that you provided. My cPanel showed PHP was running version 8 so I downgraded to version 7.4 and voila, the page now seems to be working!

    I’m now checking and testing the remainder of the site and will get back to you

    Plugin Author Scott Kingsley Clark

    (@sc0ttkclark)

    Be sure to update the code anyways because the code was written in a way that was problematic for output escaping. You can also run PHP compatibility plugins to check for other potential areas in your theme/plugins that need to be taken care of before upgrading back to PHP 8. Definitely make your plan to upgrade to PHP 8 and get that process going over the next few months.

    Thread Starter speedysweedy

    (@speedysweedy)

    If I change the code, will it not get overwritten once the theme is updated?

    Plugin Author Scott Kingsley Clark

    (@sc0ttkclark)

    That looks like a custom theme to me, I don’t think it will get overwritten because it won’t have updates beyond your own changes. Be sure to double check that yourself by looking at the style.css to see where it’s from and to see if you need to plan to have your customizations updated by a developer who can take that on.

    If it’s a custom theme, you should be totally safe to update it.

    Thread Starter speedysweedy

    (@speedysweedy)

    Hi Scott, sorry for the delay in getting back to you here. I went ahead and changed the code as you suggested and tried turning PHP v8 on again; all seems to work now so a huge thank you to you for helping me with this.

    I’m very impressed with how you were able to troubleshoot, isolate and suggest a fix so quickly to something other than your own plugin, I’m very grateful!

    Thank you!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Media Player no longer works’ is closed to new replies.