Page 1 of 1

PhocaOpenGraph Content Plugin sets wrong og:title etc. when used with latest articles module

Posted: 10 Jun 2020, 15:46
by mav
Hi!

I've noticed the problem that PhocaOpenGraph shows wrong og:description, og:title, etc. when the latest articles module is used on the same page as content. See the screenshot below:
https://i.imgur.com/r6oTwV5.png

This happens because PhocaOpenGraph Content Plugin takes the information from the module articles, not from the main article.
As the temporary solution, I have modified the file plugins\content\phocaopengraph\phocaopengraph.php file and added:

Code: Select all

	public function onContentAfterDisplay($context, &$row, &$params, $page=0) {

		//add this
		if ($params->get('article_layout', null) == null)
			return;

		$app 	= JFactory::getApplication();

if you have a better solution, please let me know.

Re: PhocaOpenGraph Content Plugin sets wrong og:title etc. when used with latest articles module

Posted: 11 Jun 2020, 01:56
by Jan
Hi, which module do you exactly get? So I can test it.

Jan

Re: PhocaOpenGraph Content Plugin sets wrong og:title etc. when used with latest articles module

Posted: 11 Jun 2020, 15:22
by mav
The module name is Articles - Newsflash (Advanced). thank you.

BTW I have updated the code, otherwise, it was throwing an error "Call to a member function get() on null" on Contacts page.

Code: Select all

	public function onContentAfterDisplay($context, &$row, &$params, $page=0) {

		//add this
		if ($params == null || $params->get('article_layout', null) == null)
			return;

		$app 	= JFactory::getApplication();
here is my subject website: software developers

Re: PhocaOpenGraph Content Plugin sets wrong og:title etc. when used with latest articles module

Posted: 11 Jun 2020, 21:16
by Jan
Hi, testing now, seems the change works OK. I will add this change to new version.

Thank you, Jan

Re: PhocaOpenGraph Content Plugin sets wrong og:title etc. when used with latest articles module

Posted: 16 Jun 2020, 12:12
by mav
Thank you for the great extension! Makes Facebook sharing much easier.

Re: PhocaOpenGraph Content Plugin sets wrong og:title etc. when used with latest articles module

Posted: 16 Jun 2020, 16:59
by Jan
Ok

Re: PhocaOpenGraph Content Plugin sets wrong og:title etc. when used with latest articles module

Posted: 16 Jul 2021, 11:20
by ThiloS
Hi Jan,

first: thanks for that nice and easy to use plugin! Works just great (except for the mav's mentioned issue with "mod_articles_news")

On my site i've had one og:title for each displayed article.
So there were quite many titles then...
Using the fix written in the third post fixed the problem!

Thanks to Mav for that as well.