• Resolved rpielanen

    (@rpielanen)


    Hi there,

    I use your plugin on my website: https://www.robertpielanen.nl/dha/
    Up till version 1.8.7 the plugin works just fine. But if I update your plugin to version after 1.8.7 I get an error on the single posts page of my website.

    The error is:
    Warning: strip_tags() expects parameter 1 to be string, object given in /data/home/robe03/domains/robertpielanen.nl/public_html/dha/wp-includes/formatting.php on line 994

    For example on:
    https://www.robertpielanen.nl/dha/straf-werk-podcast-007-by-prunk/

    I’ve tried updating to every single version up to version 1.9.9 (latest), but every time I have to roll back to 1.8.7

    I’m really sure this plugin causes the error, because I have been monitoring the problem for a long time. This issue doesn’t appear with version 1.8.7 so I leave it at this version, but I would really like to keep your plugin up-to-date.

    Can you please help me?

    * My WP is up-to-date, and all my other plugins are as well.

    Thank you

    https://www.ads-software.com/plugins/custom-field-suite/

Viewing 15 replies - 1 through 15 (of 17 total)
  • Thread Starter rpielanen

    (@rpielanen)

    Oh forgot to mention, the issue seem to be connected to a function which shows related posts to the one display on the single post page.

    Here you can see the error (development site):
    https://www.robertpielanen.nl/dha/straf-werk-podcast-007-by-prunk/

    Here you can see how it should be working (public site):
    https://www.deephouseamsterdam.com/straf-werk-podcast-007-by-prunk/

    Thanks!

    Plugin Author Matt Gibbs

    (@mgibbs189)

    CFS does not use the strip_tags function.

    Please show me your single post template code.

    Thanks,
    Matt

    Thread Starter rpielanen

    (@rpielanen)

    <?php get_header(); ?>
    	<?php
    		$gallImages = get_post_meta($post->ID, 'gallImg', true);
    		$video = get_post_meta($post->ID, 'videoEmbed', true);
    		$featured_image = get_post_meta(get_the_ID(), 'reedwan_featured_image', true);
    		$comment_type = get_post_meta(get_the_ID(), 'reedwan_comments_type', true);
    		$show_review = get_post_meta(get_the_ID(), 'reedwan_show_review', true);
    		$user_rating = get_post_meta(get_the_ID(), 'reedwan_user_rating', true);
    		$date_info = get_option('reedwan_date_info', 'true');
    		$author_info = get_option('reedwan_author_info', 'true');
    		$post_share = get_option('reedwan_post_share', 'true');
    		$category_info = get_option('reedwan_category_info', 'true');
    		$tag_info = get_option('reedwan_tag_info', 'true');
    		$share_button = get_option('reedwan_share_button', 'true');
    		$author_box = get_option('reedwan_author_box', 'true');
    		$related_posts = get_option('reedwan_related_posts', 'true');
    		$navigation = get_option('reedwan_navigation', 'true');
    		$sidebar_position = get_option('reedwan_sidebar_position', 'true');
    	?>
    <?php if($sidebar_position=='left'):  ?>
    <!-- Left Sidebar -->
    <div class="grid_4 sidebar">
    	<?php get_sidebar();?>
    </div>
    <?php endif; ?>
    	<div class="grid_8 single-post">
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<?php setPostViews(get_the_ID()); ?>
    
    		<?php if(has_post_format('video')):  ?>
    			<?php $embedVideo = htmlspecialchars_decode($video); ?>
    			<?php if($embedVideo!=''):  ?>
    			<!-- Video -->
    			<div class="featured-video embed-container">
    				<?php echo stripslashes( $embedVideo ); ?>
    			</div>
    			<?php endif; ?>
    		<?php elseif(has_post_format('gallery') ):  ?>
    		<!-- Gallery -->
    		<div id="gallery" class="royalSlider rsDefault fwImage">
    			<?php if (count($gallImages) > 0): ?>
    			<?php foreach((array)$gallImages as $gallImg ):?>
    				<a class="rsImg" data-rsBigImg="<?php echo $gallImg;?>" href="<?php echo $gallImg;?>"><img class="rsTmb" src="<?php echo $gallImg; ?>"/></a>
    			<?php
    			endforeach;
    			endif; ?>
    		</div>
    
    		<?php else: ?>
    			<?php if($featured_image=='Yes'):  ?>
    				<?php if (has_post_thumbnail()): ?>
    				<?php $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full');?>
    				<!-- Featured Image -->
    				<div class="featured-image-post">
    					<a class="standard-format-icon" href="<?php echo $large_image_url[0];?>" rel="prettyPhoto">
    					<?php the_post_thumbnail('small-slider', array('class' => 'overlay')); ?>
    					</a>
    				</div>
    				<?php endif; ?>
    			<?php endif; ?>
    		<?php endif; ?>
    
    		<!-- Single Title -->
    		<div class="single-title">
    			<h1><?php the_title(); ?></h1>
    		<?php if($date_info == 'true' || $author_info == 'true' || $category_info == 'true'): ?>
    			<div class="clear"></div>
    			<div class="single-info">
    				<?php if($date_info == 'true'): ?><span class="single-date"><strong><?php _e('Published On ', 'unicorn'); ?></strong><?php the_date(); ?> | </span><?php endif; ?>
    				<?php if($author_info == 'true'): ?><span class="single-author"><?php _e('By ', 'unicorn'); ?><?php the_author(); ?> | </span> <?php endif; ?>
    				<?php if($category_info == 'true'): ?><span class="single-category"><strong><em><?php the_category(', ') ?></em></strong></span><?php endif; ?>
    			</div>
    		<?php endif; ?>
    		</div>
    		<div class="clear"></div>
    
    		<!-- Single Content -->
    		<div class="single-content">
    			<?php if($show_review == 'Yes'): get_template_part('includes/reviews'); endif;?>
    			<?php the_content(); ?>
    			<?php if($tag_info == 'true'):?>
    				<p class="single-tags"><?php the_tags('', '', ''); ?></p>
    			<?php endif; ?>
    
    		</div>
    
    		<?php if($post_share == 'true'): get_template_part('includes/share'); endif;?>
    		<?php if($author_box == 'true'):?>
    		<!-- Author Information -->
    		<div class="box-author">
    			<h3 class="widget-line"><span class="widget-title box-title"><?php _e('About The Author', 'unicorn'); ?></span></h3>
    			<div class="author-description">
    				<div class="author-base">
    					<div class="author-pic"><a href="<?php echo get_author_posts_url(get_the_author_meta( 'ID' )); ?>"><?php echo get_avatar( get_the_author_meta('user_email'), '109', '' ); ?></a></div>
    					<?php if(get_the_author_meta('twitter') || get_the_author_meta('facebook')|| get_the_author_meta('google_plus') || get_the_author_meta('flickr')): ?>
    						<div class="author-social">
    							<?php if(get_the_author_meta('twitter')): ?>
    							<a target="new" class="author-twitter" href="https://twitter.com/<?php echo get_the_author_meta('twitter'); ?>"></a>
    							<?php endif; ?>
    							<?php if(get_the_author_meta('facebook')): ?>
    							<a target="new" class="author-facebook" href="https://facebook.com/<?php echo get_the_author_meta('facebook'); ?>"></a>
    							<?php endif; ?>
    							<?php if(get_the_author_meta('google_plus')): ?>
    							<a target="new" class="author-google" href="https://plus.google.com/<?php echo get_the_author_meta('google_plus'); ?>"></a>
    							<?php endif; ?>
    							<?php if(get_the_author_meta('flickr')): ?>
    							<a target="new" class="author-flickr" href="https://www.flickr.com/photos/<?php echo get_the_author_meta('flickr'); ?>"></a>
    							<?php endif; ?>
    						</div>
    					<?php endif; ?>
    				</div>
    				<div class="description-author">
    					<span><?php the_author_posts_link(); ?></span>
    					<span><?php the_author_meta("description"); ?></span>
    					</div>
    			</div>
    		</div>
    		<?php endif; ?>
    
    		<?php if($related_posts == 'true'):?>
    		<!-- Related Post -->
    		<?php $tags = get_the_tags(); ?>
    		<?php if($tags): ?>
    		<?php $related = get_related_posts($post->ID, $tags); ?>
    		<?php if($related->have_posts() && $related->found_posts >= 1): ?>
    			<div class="related-wrapper">
    				<h3 class="widget-line"><span class="widget-title box-title"><?php _e('Related Post ', 'unicorn'); ?></span></h3>
    				<div class="clear"></div>
    				<div class="related-item-wrap">
    					<?php $counter = 1; ?>
    					<?php
    						while($related->have_posts()): $related->the_post();
    						if(has_post_format('video'))
    						{
    							$format_icon = 'class="video-format-icon"';
    						}
    						else if (has_post_format('audio'))
    						{
    							$format_icon = 'class="audio-format-icon"';
    						}
    						else if (has_post_format('gallery'))
    						{
    							$format_icon = 'class="gallery-format-icon"';
    						}
    						else
    						{
    							$format_icon = 'class="standard-format-icon"';
    						}
    					?>
    					<div class="related-post<?php if($counter == 4) {echo' four-margin';}?><?php if($counter == 2) {echo' two-margin';}?>"id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    						<a <?php echo $format_icon; ?> href="<?php the_permalink();?>" title="<?php the_title();?>">
    						<?php if (has_post_thumbnail())
    						{
    							the_post_thumbnail('related-post', array('class' => 'overlay'));
    						}
    						else
    						{
    							echo('<img src="'.get_template_directory_uri().'/images/thumbnails/no-image-related-post.png" class="overlay" alt="no image" />');
    						}
    						?>
    						</a>
    						<h5 class="related-post-title"><a href="<?php the_permalink();?>" title="<?php the_title();?>"><?php the_title();?></a><span></span></h5>
    						</div>
    					<?php $counter++; endwhile; ?>
    				</div>
    			</div>
    		<?php endif; ?>
    		<?php endif; ?>
    		<?php wp_reset_query(); ?>
    		<?php endif; ?>
    
    		<?php if($navigation == 'true'):?>
    		<!-- Navigation -->
    		<div class="single-nav">
    			<div class="nav-left" ><?php previous_post_link('%link',  __('← Previous post','unicorn')); ?> </div>
    			<div class="nav-right" ><?php next_post_link('%link', __('Next post →','unicorn')); ?></div>
    		</div>
    		<?php endif; ?>
    
    		<?php if($comment_type == 'Both'): ?>
    		<?php
    			// Get the current page url for FB comments
    			$url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
    		?>
    		<!-- FB Comments -->
    		<div class="fb-comments" data-href="<?php echo $url; ?>" data-num-posts="4" data-width="628"></div>
    
    		<!-- WP Comments -->
    		<div class="single-comments">
    			<?php comments_template(); ?>
    		</div>
    		<?php elseif($comment_type == 'Facebook'): ?>
    		<?php
    			// Get the current page url for FB comments
    			$url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
    		?>
    		<!-- FB Comments -->
    		<div class="fb-comments" data-href="<?php echo $url; ?>" data-num-posts="4" data-width="628"></div>
    
    		<?php elseif($comment_type == 'WP'): ?>
    		<!-- WP Comments -->
    		<div class="single-comments">
    			<?php comments_template(); ?>
    		</div>
    
    		<?php elseif($comment_type == 'None'): ?>
    
    		<?php else: ?>
    		<!-- WP Comments -->
    		<div class="single-comments">
    			<?php comments_template(); ?>
    		</div>
    		<?php endif; ?>
    
    		<?php endwhile; endif; ?>
    	</div>
    	<?php if($sidebar_position=='right'):  ?>
    <!-- Right Sidebar -->
    <div class="grid_4 sidebar">
    	<?php get_sidebar();?>
    </div>
    <?php endif; ?>
    <?php get_footer(); ?>

    [Moderator Note: No bumping, thank you.]

    Plugin Author Matt Gibbs

    (@mgibbs189)

    My guess is that the issue lies within the get_related_posts function (in your theme?).

    Thread Starter rpielanen

    (@rpielanen)

    <?php
    
    // Related Post
    function get_related_posts($post_id, $tags = array()) {
    	$query = new WP_Query();
    
    	$post_types = get_post_types();
    	unset($post_types['page'], $post_types['attachment'], $post_types['revision'], $post_types['nav_menu_item']);
    
    	if($tags) {
    		foreach($tags as $tag) {
    			$tagsA[] = $tag->term_id;
    		}
    	}
    	$query = new WP_Query( array('showposts' => 4,'post_type' => $post_types,'post__not_in' => array($post_id),'tag__in' => $tagsA,'ignore_sticky_posts' => 1,
    	));
      	return $query;
    }
    ?>
    Thread Starter rpielanen

    (@rpielanen)

    That would be this code, i think

    Thread Starter rpielanen

    (@rpielanen)

    Still having the same problem, all themes and plugins are up to date. How can it be this problem only arises when I update the custom field suite plugin to a version after 1.8.7.

    I’ve asked the theme developer as well but not much happening there. Anyone who can help me with this?

    Thanks in advance.

    Plugin Author Matt Gibbs

    (@mgibbs189)

    If you could email an admin login to hello[at]uproot.us, I could try to take a look within the next couple days.

    Alternatively, search within your wp-content folder for strip_tags. It should be a matter of inspecting each variable that gets passed into strip_tags, to see which one is an object (and why)…

    Thread Starter rpielanen

    (@rpielanen)

    I’ve sent you a admin login, I will look for the strip_tags but I’m not that good at programming so your help is greatly appreciated!

    Plugin Author Matt Gibbs

    (@mgibbs189)

    Can you show me everything within this file:

    /extensions/customfieldsreau/customfieldsreau.php

    Thread Starter rpielanen

    (@rpielanen)

    <table class="reviewreau">
    	<tr>
    		<td class="reviewcatname"><?php echo 'Recordlabel:';?></td>
    		<td class="reviewcatvalue"><?php echo $cfs->get('recordlabel');?></td>
    	</tr>
    	<tr>
    		<td class="reviewcatname"><?php echo 'Catalogue:';?></td>
    		<td class="reviewcatvalue"><?php echo $cfs->get('catalogue');?></td>
    	</tr>
    	<tr>
    		<td class="reviewcatname"><?php echo 'Territory:';?></td>
    		<td class="reviewcatvalue"><?php echo $cfs->get('territory');?></td>
    	</tr>
    	<tr>
    		<td class="reviewcatname"><?php echo 'Format:';?></td>
    		<td class="reviewcatvalue"><?php echo $cfs->get('format');?></td>
    	</tr>
    	<tr>
    		<td class="reviewcatname"><?php echo 'Dealer Price:';?></td>
    		<td class="reviewcatvalue"><?php echo $cfs->get('dealerprice');?></td>
    	</tr>
    	<tr>
    		<td class="reviewcatname"><?php echo 'Release date:';?></td>
    		<td class="reviewcatvalue"><?php echo $cfs->get('release_date');?></td>
    	</tr>
    </table>
    Thread Starter rpielanen

    (@rpielanen)

    That’s it ??

    Thread Starter rpielanen

    (@rpielanen)

    Hi! Any thoughts on where to look next?

    thanks so much!

    Thread Starter rpielanen

    (@rpielanen)

    Hi Matt,

    I don’t want to seem impatient, but have you been able to find anything?
    If not, or if you don’t want to spend more time on this. Please tell me so.

    Thanks for your help so far.

    Robert

    Plugin Author Matt Gibbs

    (@mgibbs189)

    I apologize, but I’m not able to find any correlation between CFS and that strip_tags PHP warning. When you disable CFS and comment out all $cfs->get code, does the issue still appear?

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Versions after 1.8.7 cause Warning: strip_tags() expects parameter 1 to be strin’ is closed to new replies.