Topic-icon Open Graph Actions

Active Subscriptions:

None
9 years 8 months ago #46170 by saldon
Replied by saldon on topic Open Graph Actions
Hi Alex,

sorry for limitations but the owner prefers to give administrator permissions only. Anyway, I have extended your permissions so that you can manage Articles, ArtioSEF and JOTCache. (You don't need to disable caching since it is disabled by default for administrators)

However I have investigated and I have found two problems:

1) Since the site uses a component for the multicategorization which stores all categories of an article as an array "cat1|cat4|cat3|...|catn" (it has hacked Joomla core files), when an article belongs to more than one category the error message is "Action is not associated to the object type of this page".

Probably, the JFBConnect component/plugin code should be modified to read the correct category_id.

2) On an article with one only category assigned to it and ArtioSEF plugins enabled, the error message is "Error: (#3502) Object at URL www.mysite.com/page.html has og:type of 'article'. The property 'ricetta' requires an object of og:type 'namespace:ricetta'." even if, by checking the source code the og:type is set properly to 'namespace:ricetta'.

In the case 2), by disabling the SEF (all SEF plugins), it works properly and the action is posted on the FB timeline.

So:

- Article with 1+ categories --> It doesn't work

- Article with 1 category and SEF enabled --> It doesn't work (even if the og:type is set properly)

- Article with 1 category and SEF disabled --> It works!

Any ideas?

Thanks and regards
Salvatore
The topic has been locked.
Support Specialist
9 years 8 months ago #46174 by alzander
Replied by alzander on topic Open Graph Actions
Salvatore,
Great investigation on narrowing things down. A few questions though:
1) I'm not sure what you mean with the multiple categories. You've made changes to core Joomla files? In that case, I'm not sure what we could do here. JFBConnect does read the catid value for an article. The code we use is:
JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_content/models');
$contentModel = JModelLegacy::getInstance('Article', 'ContentModel');
$item = $contentModel->getItem((int)$queryVars['id']);
$catId = $item->catid;
That's using the standard Joomla model classes to load an article and get the category it's assigned to. If you need to modify that behavior, you can find the code in the /plugins/opengraph/content/content.php file.

2) Can you post a URL where it's not working when SEF is enabled? We'll need to see what object URL the action URL is actually trying to call. It's possible it's trying to trigger an action on a different URL for some reason, and we'd need to investigate if that's a bug or configuration issues.

3) Glad it works 'normally'. Now we just need to get at least #2 working. Not sure what we would be able to do about #1 though.

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

None
9 years 8 months ago #46203 by saldon
Replied by saldon on topic Open Graph Actions
Hi Alex,

I have a good news with respect to the point #2. I have tested again the behaviour before to reply to you. I have cleared the cache of the article with one only category assigned to it and I tried again to perform the action with SEF enabled. It has worked!.

Now I have to solve the problem about those articles having more than one categories assigned to them.(the point #1)

I have installed a component to improve Joomla with the management of multiple categories for each content. It has changed the Joomla files in components/com_content/ in order to load all articles belonging to a category within an array of catid. So the standard Joomla model classes fail in loading the catid.

I will try to modify the source code of JFBConnect in order to read the right category but I have 2 questions:

#1. Where is the code in which JFBConnect compare the catid of the article with the category choosen in the configuration?

#2 How to do in order to apply the action to all categories of the site? In the combo list I can't choose more than one category.

About #2, could you suggest me a way to change the code in order to skip the category selection and to apply the behaviour to all categories? In this way, it will work without applying the changes in #1. Then I will filter the loading of the action button by putting it in a module and chosing categories from the module filtering.

Thanks again for your support

Regards
Salvatore
The topic has been locked.
Support Specialist
9 years 8 months ago #46216 by alzander
Replied by alzander on topic Open Graph Actions
Glad to hear you found the caching issue with #1. Good progress is always good to hear :)

For the category selection, when you choose a category in the Open Graph object area, it will apply to that category and all sub-categories. Of course, we only expect and work with one category per article, so that may still cause some issues for you.

As for where our code works to check the category, it's also in the /plugins/opengraph/content/content.php file. There's a function called "getBestCategory". That will check the catId of the article, pulled from the block of code a little higher in that file (that I also posted above) to determine which object is the best choice for the article.

Basically, you can create many Open Graph Objects in JFBConnect. One object could be on a root level category that would work for all sub-categories. You could also then create an Open Graph object for just one of the sub-categories. The getBestCategory function will select the most specific object for the article. So, instead of the parent object, it would select the sub-category object if the article is in that category.

That makes the Object creation process very flexible as you can create a parent object that works for all content, and then selectively set an object to just a few sub-categories.

I hope that helps explain the process. If you need more help with the above, just let me know.

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

None
9 years 8 months ago #46283 by saldon
Replied by saldon on topic Open Graph Actions
Hi Alex ,

thanks for your suggestions. I'll try to adapt the code to make it working with multi-categories.

I'll let you know if it works

Thanks again.
Salvatore
The topic has been locked.
Support Specialist
9 years 8 months ago #46284 by alzander
Replied by alzander on topic Open Graph Actions
No problem for the help. Let me know how it goes or if you need anything else from us.

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

None
9 years 7 months ago #47097 by saldon
Replied by saldon on topic Open Graph Actions
Hi Alex,

I have just successful implemented the workaround with the following two lines of code:
$catarray = explode(',',$catId);
$catId = current($catarray);

Thanks
Salvatore
The topic has been locked.
Support Specialist
9 years 7 months ago #47099 by alzander
Replied by alzander on topic Open Graph Actions
Salvatore,
Awesome! I'm glad to hear you found a solution that works for you. Should you have any other questions, comments or general feedback, definitely let us know.

Finally, if you haven't already, please consider leaving a rating and review for JFBConnect, or our support, on the Joomla Extension Directory. It certainly isn't required, but is very appreciated:
extensions.joomla.org/extensions/social-...ook-integration/7215

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

None
9 years 7 months ago #47125 by saldon
Replied by saldon on topic Open Graph Actions
Hi Alex,

I just reviewed the component on Joomla! Extensions two days ago :-). It is the latest one.

Thanks
Salvatore
The topic has been locked.
Support Specialist
9 years 7 months ago #47136 by alzander
Replied by alzander on topic Open Graph Actions
Salvatore,
Thanks so much for the review. It's definitely appreciated.

If you run into any other issues or have comments or suggestions for features or improvements, please let us know.

Thanks,
Alex
The topic has been locked.