Topic-icon {JFBCLike} inserted in Joomla editor but showing twice

Active Subscriptions:

None
Hi there,
On my K2 category I put this LIKE code according to your documentation with some tweaked values
{JFBCLike layout=button_count url=https://www.facebook.com/Fruzitime font=verdana show_send_button=false}

the LIKE button shows where I excpexted but also left top in the header. see attachment
File Attachment:
The topic has been locked.
Support Specialist
Rodster,
The problem is that whatever component is on that page is taking the introtext or wherever you put the Like button, and using it for the meta description (or some other) tag. Then, JFBConnect is replacing the tag in your head area with the Like button HTML causing that weirdness.

We have a fix that we're testing right now for this, which will be in the release coming out later today. It's a bit tricky to remove the tag in the head area without causing other problems, so we're going to add a new option to enable/disable this feature while we get feedback.

If you're interested in implementing it to see if it fixes the issues on your site right now, before the release, we'd love to hear your feedback on how it goes. Our ix may need some tweaking though, so if it causes other issues, rest assured, we'll help fix those.

To make the change, please edit the /plugins/system/jfbcsystem/jfbcsystem.php file. Around line 313, you'll see the following block of code:
/*
             * Code to strip any {JFBCxyz} tags from head. Caused issues on some users sites in 4.3.1
             * Removing until more error-proof method found.
            //Get the head
            $content = JResponse::getBody();
            $regex = '|<head(.*)?</head>|sui';
            preg_match($regex, $content, $matches);

            //Remove the tag if it's in the head
            $newHead = preg_replace('|{'.$tag.'(.*?)}|ui', '', $matches[0]);

            //Replace the head
            $content = preg_replace('|<head(.*)?</head>|sui', $newHead, $content);
            JResponse::setBody($content);
            */
Replace that whole block with the following:
/*
             * Code to strip any {JFBCxyz} tags from head. Caused issues on some user's sites in 4.3.1
             * Removing until more error-proof method found.
             */
            //Get the head
            $content = JResponse::getBody();
            $regex = '|<head(.*)?</head>|sui';
            if (preg_match($regex, $content, $matches))
            {
                if (count($matches) == 2) // more than one head is a problem, don't do anything
                {
                    //Remove the tag if it's in the head
                    $newHead = preg_replace('|{' . $tag . '(.*?)}|ui', '', $matches[0], -1, $count);

                    if ($count > 0)
                    {
                        //Replace the head
                        $content = preg_replace('|<head(.*)?</head>|sui', $newHead, $content, -1, $count);
                        if ($count == 1) // Only update the body if exactly one head was found and replaced
                            JResponse::setBody($content);
                    }
                }
            }
Make sure you do not leave the */ from the bottom of original block, or you will run into issues.

Hope that helps, and keep us posted. Otherwise, wait for the new release and in the Configuration -> Misc tab, there will be a new "Experimental" section with just this setting. Enable that and test away!

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
13 years 5 months ago #29002 by rodster
Thanks for your reply! I prefer to wait for the release..just let me know when and I will help test it and provide you with some feedback.
The topic has been locked.
Support Specialist
The updated release is out. Feel free to update and try the new setting in the Configuration -> Misc tab. Test on pages that don't even have the problem as JFBConnect could make modifications to the HTML of each page when that is enabled, and could cause problems if it does.

Let me know how it goes, we'd love to have your feedback!

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
13 years 5 months ago #29019 by rodster
Have upgraded to v4.3.3 so far the tag has been removed when I use the experimental setting.
This issue can be marked as solved.
The topic has been locked.
Support Specialist
Fantastic. Definitely 'click around' to other pages on your site and really test. We implemented a similar (but different) fix in the v4.3.1 release and it was a disaster. It basically made some pages completely empty (white screen). We vastly improved our method for removing those tags, but decided to add it as a configuration option to make life easier.

Either way, glad that got you going, and keep us posted on if you run into anything else or have any feedback in general.

Thanks,
Alex
The topic has been locked.