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

Phoca plugins - support for all Phoca plugins except Phoca Gallery plugins
User avatar
mav
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 10 Jun 2020, 15:33

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

Post by mav » 10 Jun 2020, 15:46

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.

Tags:

User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 44099
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

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

Post by Jan » 11 Jun 2020, 01:56

Hi, which module do you exactly get? So I can test it.

Jan
If you find Phoca extensions useful, please support the project

User avatar
mav
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 10 Jun 2020, 15:33

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

Post by mav » 11 Jun 2020, 15:22

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

User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 44099
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

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

Post by Jan » 11 Jun 2020, 21:16

Hi, testing now, seems the change works OK. I will add this change to new version.

Thank you, Jan
If you find Phoca extensions useful, please support the project

User avatar
mav
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 10 Jun 2020, 15:33

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

Post by mav » 16 Jun 2020, 12:12

Thank you for the great extension! Makes Facebook sharing much easier.

User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 44099
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

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

Post by Jan » 16 Jun 2020, 16:59

Ok
If you find Phoca extensions useful, please support the project

ThiloS
Phoca Newbie
Phoca Newbie
Posts: 1
Joined: 16 Jul 2021, 11:15

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

Post by ThiloS » 16 Jul 2021, 11:20

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.

Post Reply