Need to get rid of comma in this IQ Testimonials plugin code

Hi,
I'm using a Wordpress plugin called IQ Testimonials. I've tried to address this issue with the plugin dev, but he seems to be AWOL (not a good sign...)
Anyway the plugin echoes testimonials. There are custom fields for name, location etc. There is a comma separating these. If location isn't chosen, then the comma shouldn't be showing, but it is. I've looked over the plugin code and it seems that it should work. But that dang comma keeps showing up.

http://sandbox.intrepidrealist.com/selva-armonia/testimonials/

Here's the pertinent code:

$results = $wpdb->get_results($query, ARRAY_A);
		$i=1;
		foreach ($results as $data) {
			// Setting the testimonial information to variables for easy access
			if (($data['featured'] == 1) && (!$dynamically_rotate == true)) {
				$featuredpre = '<div class="iq-testimonial-wrap"><div class="iq-testimonial-featured">';
			}
			else
			{
				$featuredpre = '<div class="iq-testimonial-wrap"><div class="iq-testimonial-body">';
			}
			$name = stripslashes($data['name']);
			if (!empty($name)) {$name = '<span class="iq-testimonial-name">'.$name.'</span>';}
			
			$location = '<span class="iq-testimonial-location">'.stripslashes($data['location']).'</span>';
			if ((!empty($name)) && (!empty($location))) {$location = ', <span class="iq-testimonial-location">'.$location.'</span>';}
			$quote = '<span class="iq-testimonial-quote">'.stripslashes($data['quote']).'</span>';
			$websitepre = '';
			$websitesuf = '';
			$website = str_replace('http://','',$data['website']);
				if (!empty($website)){					
					$websitepre = '<br /><a class="iq-testimonial-website" href="http://'.$website.'" target="_blank">';
					$websitesuf = '</a>';
				}
			$imagelink = $data['imagelink'];
				if (!empty($imagelink)) {
					list($width_orig, $height_orig) = getimagesize($imagelink);
					$ratio_orig = $width_orig/$height_orig;
					if ($max_image_width/$max_image_height > $ratio_orig) {
   						$width = $max_image_height*$ratio_orig;
						$height = $max_image_height;
					} else {
   						$height = $max_image_width/$ratio_orig;
						$width = $max_image_width;
					}
					$imagelink = '<img class="iq-testimonial-image" src="'.$imagelink.'" width="'.$width.'" height="'.$height.'" />';
				}
			if (($show_more == true) && ($show_more_link > '')) {
				$show_more_html = '<div class="iq-testimonials-more"><a class="iq-testimonials-more-link" href="'.$show_more_link.'">'.$show_more_text.'</a></div>';
			}
	
			// Final HTML Output
			if ((!$is_shortcode == true) && ($dynamically_rotate == true) && ($i > 0)) {
			if ($i == 1) {
				$theTestimonial .= '<div class="iq-testimonial-wrap"><div class="iq-testimonial-body">' . $imagelink .' '. $quote . '<br />' .$name. $location . ' ' . $websitepre . $website . $websitesuf . '</div>'.$show_more_html.'</div>';
				}
				else
				{
			$theTestimonial .= '<div class="iq-testimonial-wrap" style="display: none;"><div class="iq-testimonial-body">' . $imagelink .' '. $quote . '<br />' .$name.$location . ' ' . $websitepre . $website . $websitesuf . '</div>'.$show_more_html.'</div>';
				}
			}
			else
			{
			$theTestimonial .= $featuredpre . $imagelink .' '. $quote . '<br />' .$name.$location . ' ' . $websitepre . $website . $websitesuf . '</div></div>';
			}
			$i++;
			//echo $theTestimonial;
		}

Open in new window


Thanks!
LVL 9
Alicia St RoseOwner & Principle Developer/DesignerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jason C. LevineNo oneCommented:
Line 16?
0
Ray PaseurCommented:
Wow, WordPress.  No wonder you can't find the author any more.  If I had written that plugin and released it into the public domain I would want to run and hide, too.

The trailing comma could come from more than one place, and there is no readily available way of finding it.  Your choices are not pretty.  You might re-write the plug-in (that would be the professional answer) or you might try changing all of the commas in the variable named $theTestimonial to blanks.  It's not going to be pretty but it's a fast way to constructively eliminate the display of trailing commas.

Here at EE, you could hire our Expert @jason1178 who might be able to help you.  Or you could make a Google search for Aaron Brazell. He lives in Baltimore and he is a subject-matter expert who could rewrite the plug-in.  Either way you have some costs, but that is better than having unwanted output.

Often the code is only worth what you paid for it.  Or to put it another way, in the words of the great oil well fire fighter Red Adair, "If you think it's expensive to hire a professional, just wait till you hire an amateur!"
0
Alicia St RoseOwner & Principle Developer/DesignerAuthor Commented:
Sorry for the delay in responding.
So code is that bad huh? And that's only a snippet. I'm not even a pro coder and I can tell this plugin is a bit janky. Next time I'll just use my own jquery and custom fields. For now, I'm already overbudget...and eating it.

The solution we came up with was to add a location to every quote. That way there is something behind that damn comma!

I try and only use well maintained and rock solid plugins. I needed the fade in effect fast! You should see the backend admin for this dog. Anyway, want to give a shout out to amazing FREE plugins with coding that would make you proud:

Foxyshop
Dynamic Widgets
Post2Posts
Advanced Custom Fields

I cannot live without 'em for certain projects.

And finally, Thank you for the resources and the quote, Ray_Paseur! Will be using that quote in the future when folks balk at my price!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

Ray PaseurCommented:
Glad you enjoyed the quote.  It's one of my favorites, too.

Thanks for using EE, ~Ray
0
Jason C. LevineNo oneCommented:
Foxyshop

Don't know it.

Dynamic Widgets

Makes stuff slow.  May want to investigate other ways to get same effect via direct coding of sidebars and templates.

Post2Posts
Advanced Custom Fields

These two are awesome sauce.
0
Alicia St RoseOwner & Principle Developer/DesignerAuthor Commented:
jason1178,
Thanks for the tip on Dynamic Widgets. I'll definitely look into other options if it will make the sites load faster. I love it, but I do admit my clients get the glaze over when I show them how to manage it.

Foxyshop is AWESOME. It's a plugin crafted by Sparkweb for Foxycart, which is an e-commerce solution that offers just a cart, checkout and receipt template and shoots the datafeeds at you when sales happen. So you can build your own CMS around it. And Sparkweb does an amazing job and he's SO HELPFUL!

I was never going to touch e-commerce again until I found Foxyshop plugin and Foxycart and the helpful folks on their support forum.
0
Alicia St RoseOwner & Principle Developer/DesignerAuthor Commented:
I'm pretty sure everything you mentioned would fix the problem. So I'm shelling out the points in your direction!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.