Topic-icon K2 Likes OK but all Comments are missing after upgrade

Active Subscriptions:

None
8 years 4 months ago #56300 by dageke
Thanks for the explanation.

So there are two different types of URLs at work here, with or without the "component/k2". I have tried both versions, and I don't get any comments on either. Could you please explain again how I get the comments back. Worst case, I need to manually get them back for every k2 article, you said...

I get the comments on that Facebook developer page ( developers.facebook.com/docs/plugins/comments#configurator ), but the same URL on my website produces no comments...

I still don't understand why all (it seems) except one article ( www.thailandstidende.com/component/k2/it...partybaren-jubilerer ) has Likes, but focus on the first problem first.

Best
The topic has been locked.
Active Subscriptions:

None
8 years 4 months ago #56302 by dageke
URGENT

Please explain how i manually tag k2 items in order to get the comments back. I need to send out newsletter now...
The topic has been locked.
Support Specialist
The issue is that Facebook caches the tags it sees on your pages. If you run a URL through the Facebook URL Debug Tool and use the "Fetch new scrape information" button, it will update their cache immediately instead of waiting 1-7 days for it to happen automatically. Once you scrape, you can refresh your page and test to see if things work how you expect or not.

In order to tag your page, there's a few things you may need to do depending on the URL that needs to be set:
Setting the og:url tag
Inside the K2 article contents, simply add the following tag:
{SCOpenGraph url=http://link-to-proper-url}
That should fix your Like count from what we observed above.

For Comments
Use the following tag to add a custom Comment box:
{SCFacebookComments href=http://link-to-proper-url}
That will add a new comment box. You will want to add that tag at the end of your K2 items. Then, in the JFBConnect -> Social -> K2 Comments configuration, set the comma-separated list of K2 items that should not have the comment box added automatically. That way, your manual one will appear and the automatic one won't.

After you make the changes above to each article, use the debug tool to re-scrape and then test that it works as expected. It will be tedious, but it's the only way to salvage old Likes/Comments whenever your URL structure changes.

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

None
8 years 4 months ago #56304 by dageke
The "Fetch new scrape information" and reload of the article on my page did not bring the comments back.

This is strange, because my URL structure DID NOT CHANGE from Joomla 2.5 to the upgraded 3.4 version. Perhaps something else is wrong. Should I reinstall your component?

The comments are noe lost, because they appear on the Comments Plugin Code Generator page ( developers.facebook.com/docs/plugins/comments#configurator ). The URL there is the same as on my website, but there the comments are gone. Manually changing 1800 articles will be the absolut last resort....

Best
The topic has been locked.
Support Specialist
The Comments box is using the wrong URL still. If you open the source HTML on the page, it looks like:
<div class="sourcecoast facebook comments jfbccomments"><div class="fb-comments" data-href="http://www.thailandstidende.com/item/2838-quizmaster-satser-pa-jomtien" data-width="650" data-numposts="50" data-colorscheme="light" data-mobile="false" data-order-by="social"></div>
You'll need to use the SCFacebookComments tag as noted above to set a custom URL for the comments box.

The og:url tag does look to be set properly, which is why the Like button is working. Why Facebook uses 2 different methods for the URL is not something I can answer.

As to why the URLs changed, I don't have an answer for that either. My best recommendation to investigate would be to restore a backup of your site from Joomla 2.5 to determine the URLs that were used in the browser and those set by JFBConnect to determine where the differences lie. You could also make sure you're running the same versions of K2 and JFBConnect in Joomla 2.5 and 3.4 so that we can narrow down which extension, of it's Joomla itself, that is changing the URLs.

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

None
8 years 4 months ago #56314 by dageke
I have never done anything like restoring an old version of Joomla. I need help if you want me to do that.

At this point I need to get to the root of the problem. I also noticed the source code, and I want to ask you: Is it or is it not Sourcecoast code that is generating the wrong url here:

<div class="fb-comments" data-href="www.thailandstidende.com/item/2838-quizmaster-satser-pa-jomtien" ...

If the problem lies with Sourcecoast, that means that either you have to come up with a solution or I have to look for an alternative method not involving Sourcecoast code. Again, manually changing 1800 news articles is not an option.
The topic has been locked.
Support Specialist

I have never done anything like restoring an old version of Joomla. I need help if you want me to do that.

That really depends on how you perform backups of your site as it is. I wouldn't know the best way to restore a backup for your site, that's different for every site, but when you restore it, you could put it in a sub-folder of your existing site (or anywhere else) for testing. The main thing we'd want to test is what URLs are created in Joomla 2.5 as that will help narrow down where things start going wrong in Joomla 3.x.

At this point I need to get to the root of the problem. I also noticed the source code, and I want to ask you: Is it or is it not Sourcecoast code that is generating the wrong url here:

That code is from JFBConnect. When we generate the URL for K2 items, we call the following code:
require_once(JPATH_SITE . '/components/com_k2/helpers/route.php');
        $url = K2HelperRoute::getItemRoute($article->id . ":" . urlencode($article->alias), $article->catid);
That code is asking K2 for the SEF route to the article with the ID provided. I don't know why that changed from Joomla 2.5 to 3.x. It could be a newer version of JFBConnect, K2 or Joomla itself. Thats why, again, it will be helpful to understand how your site was configured before you updated by using a backup site to test with.

When you upgraded, did you upgrade JFBConnect and K2 as well?

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

None
8 years 4 months ago #56317 by dageke
I took a "Full Backup" via CPanel of the old 2.5 site. That file of about 2 Gb is now on another server under another domain name. What do I do to restore the old Joomla 2.5? Just unzip? Do I need to create new database etc. etc?

Anyway, regarding URLs, the old site had the EXACT same URLs as the new site. I know this for a fact, because I checked old postings on our Facebook page.

www.facebook.com/ThailandsTidende/posts/1028260270563722 (this articled had a number of comments)

More info:
I use URL rewriting in Global Configuration. Regarding K2 and SEF, I have ticked "NO" to "Enable advanced SEF for K2 URLs" under advanced parameters in K2.

I am using only a tiny part of your extension, namely Facebook Likes and Comments. If I could only figure out a way to call the Facebook comments from an Extra Field or from the Social parameter in K2, the problem would be solved. But I cannot seem to get the current document URL into the data-href field:

<div class="fb-comments" data-href="www.thailandstidende.com/component/k2/it...okser-stadig-raskere" data-width="450" data-numposts="50">


In html you're supposed to write either "document.URL" or "location.href" in order to get the current document URL, but it does not work. Any ideas?

Yes, I upgraded both JFBConnect and K2
The topic has been locked.
Support Specialist

I took a "Full Backup" via CPanel of the old 2.5 site. That file of about 2 Gb is now on another server under another domain name. What do I do to restore the old Joomla 2.5? Just unzip? Do I need to create new database etc. etc?

I have no clue how to restore that backup. That's well out of our purview. It will greatly increase the odds of us finding a solution though if we can compare the original site to the new Joomla 3.x site with upgraded versions of JFBConnect, K2 and all other changes you've made.

Anyway, regarding URLs, the old site had the EXACT same URLs as the new site. I know this for a fact, because I checked old postings on our Facebook page.

We've posted the code we use to get the URL for the current article above. That is asking K2 what the proper SEF URL should be for the page and it's returning the /item/... URL. That's how it works. I'm not sure if that's a change from the version of K2 you were previously using, but that looks to be how it works now. Again, knowing which versions you were using previously and, especially, seeing it work on the Joomla 2.5 site would help narrow down where the issue is.

Searching for common K2 issues regarding /item/ in the URLs, there's quite a few topics out there about various issues with URLs (on other sites, not this site). Again, I don't know what version of K2 you were using prior to this, but in 2.6.4 is when they added the SEF configuration options. You can read more in their changelog . I'm assuming you were on a newer version than this. If not, those 'improvements' in the newer versions of K2 could be what's changing how their router returns the different URL when we ask for it now.

But I cannot seem to get the current document URL into the data-href field:

You can't use Javascript in that field. You need to use an actual URL value.

I did just think about another option that may work for you though. Instead of using the JFBConnect - Content plugin to automatically add Comments to each K2 article, you could create an SCSocialWidget instance of Facebook -> Comments and have it display in a module position under your K2 content. The SCSocialWidget will always use the current URL if you leave the URL parameter blank and it doesn't try to ask K2 for the 'best' URL for the page. Instantiating a SCSocialWidget module like this should work across all your K2 items if it works as I'd expect.

I hope that helps,
Alex
The topic has been locked.
Active Subscriptions:

None
8 years 4 months ago #56327 by dageke
Creating a new Social Widget module worked, so I've implemented that now. Finally the comments are back. Thank you for looking into this and not giving up :)

I will try to reinstall the old 2.5 Joomla version in a day or two. Will report back at that point. And please give me a heads-up if you come acoss the reason for this strange k2 behaviour via some other channel...

Thanks again, Alex

Dag
The topic has been locked.