Topic-icon K2 Autopost using wrong links

Active Subscriptions:

None
7 years 2 months ago #60802 by jure
Hi,
as said in the title K2 autopost is using the wrong links when posting to any social network. The wrong link used for K2 looks like /k2/itemid instead of /category/item-title.
We are using JoomSEF, so I tried putting JFBConnect later in the load order, but that didn't change anything. I fixed the old liks by hand via a redirect, but I can't keep doing that for every article we post.
Any suggestions?
Thanks
The topic has been locked.
Support Specialist
7 years 2 months ago #60827 by alzander
This isn't an issue we've heard of before and I'm not sure what's going wrong here. We do call SEF on the K2 URL and it seems like it's trying to be made into a proper route. I'm not sure what JoomSEF does or doesn't do.

I'd recommend, temporarily, disabling JoomSEF and using Joomla's SEF router. Then, test a K2 URL by navigating to it and by using the autopost feature to see if they use similar URLs. If so, that means there's something going on with JoomSEF.

If the URLs are different, let us know what they look like so we can investigate further.

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

None
7 years 2 months ago - 7 years 2 months ago #60829 by jure
Replied by jure on topic K2 Autopost using wrong links
What's interesting is that I've always had the k2 set to default the default k2 router, since JoomSEF allows you to pick it for specific components. Basically default k2 SEF should be in use. So it's not a surprise that using any other router or disabling whole JoomSEF made no difference.
I also tried completely disabling SEF for k2 and posting something. The url then seemed to be almost right, but still not ok.
The posted link looked like this: index.php?option=com_k2&amp%3Bview=item&amp%3Bid=1536, but it should use just normal "&" characters which worked after correcting the url. Should just be: index.php?option=com_k2&view=item&id=1536.
I'm still not sure what's up with k2 links that use SEF, forgot to mention before that even putting it in the load order after k2 makes no difference.
Last edit: 7 years 2 months ago by jure.
The topic has been locked.
Support Specialist
7 years 2 months ago #60873 by alzander
We're looking into this further to see if we can reproduce the different links with a standard Joomla installation. This isn't a problem we've had reported before, so it will take a little investigation.

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

None
7 years 2 months ago #60879 by jure
Replied by jure on topic K2 Autopost using wrong links
Ok, I hope you manage to reproduce it. Otherwise I can also set up an account on our site, so you can investigate directly. Let me know if one is needed.
The topic has been locked.
Support Specialist
7 years 1 month ago #60932 by mel
Replied by mel on topic K2 Autopost using wrong links
We're very sorry for the delay in response. It took a bit of hunting around to reproduce this issue on our test site as we had a hard time getting the category added to the link. Once we enabled the option in K2 settings > Advanced > Advanced SEF Settings > 'Enable advanced SEF for K2 URLs', we had similar as you're describing in your first post.

I think it should be a small change of code.

1. Could you verify that you have the 'Enable advanced SEF for K2 URLs' option enabled?
2. Could you try replacing /plugins/opengraph/k2/k2.php at line 438
$link = 'index.php?option=com_k2&view=item&id='.$item->id;
with
require_once(JPATH_SITE . '/components/com_k2/helpers/route.php');
$link = K2HelperRoute::getItemRoute($item->id . ":" . urlencode($item->alias), $item->catid);

Let us know whether this helps to resolve your issue or if you continue to have incorrect autopost URLs.

Thanks
-Melissa
The topic has been locked.
Active Subscriptions:

None
7 years 1 month ago #61007 by jure
Replied by jure on topic K2 Autopost using wrong links
Hi, thanks for the solution.
I can confirm that the fix works and I have the Advanced SEF option in K2 enabled. Links now appear correctly when autoposted.
The topic has been locked.
Support Specialist
7 years 1 month ago #61008 by mel
Replied by mel on topic K2 Autopost using wrong links
Thanks for letting us know. I'll be including the fix in the next release.

-Melissa
The topic has been locked.