PDA

View Full Version : VBET Doesn't rewrite Open graph descriptions



mykkal
19-06-15, 08:22
Hey Martin,

Found another bug for you. It has to do with social sharing using this version. Whenever I share from a translated url the opengraph data uses the original content from the english version.

For instance this url is in italian but the open graph tags pull the descriptyion and sharing url from the english version: Truffa Fittizio, Agente modellante Julia Rodi (http://mymodeltalk.com/jobs/it/modeling-nigerian-419-industry-scams/330355-scam-ficticious-modeling-agent-julia-rhodes.html)
You have to view the source to see what I mean. Below is an extract:


<meta property="og:description" content="Hello my name is Julia Rhodes, and am a freelance modeling agent working for female first magazine in recruiting models.Female first Magazine" /><meta property="og:url" content="http://mymodeltalk.com/jobs/modeling-nigerian-419-industry-scams/330355-scam-ficticious-modeling-agent-julia-rhodes.html" /><meta property="og:type" content="article" /><meta property="og:image" content="http://mymodeltalk.com/file/style/mmt/newslettergraphic.jpg" /><meta property="og:title" content="Scam by Ficticious Modeling Agent Julia Rhodes" />

Everything except the "og:image content" should be in italian. So far this fails to translate or display the correct description, url location,and title.

Do you have any code I could use to fix this? If some reads the thread in their native language i'm sure they want to share it on social media in their native language.

I found this error through google webmaster tools. it reported duplicate descriptions and titles.

Marcin Kalak
19-06-15, 14:46
Hi,
I see that you are adding open graph tags using Open Graph Description & Title Fix on Threads/Blog. You must integrate this product with vBET.
To integrate this product with full version of vBET:

Edit plugin AdminCP->Plugins & Products->Plugin Manager->Open Graph Description / Tile Override
Paste this code at the beginning:

require_once(DIR. '/includes/vbenterprisetranslator_functions.php');
require_once(DIR. '/includes/vbenterprisetranslator_functions_utils.php');
global $vbulletin;
$forumLanguage = $vbulletin->options['vbenterprisetranslator_forumlanguage'];
$language = $_REQUEST['language'];
$serie = microtime(true) * 10000;
Find:

$og_array['og:description'] = $thread['meta_description'];
$og_array['og:title'] = $thread['title'];
REPLACE it with this code (For utf-8 characters):

$og_array['og:description'] = vbet_translateText($thread['meta_description'], $forumLanguage, $language, $serie);
$og_array['og:title'] = vbet_translateText($thread['title'], $forumLanguage, $language, $serie);
REPLACE it with this code (For not utf-8 characters):

$og_array['og:description'] = vbet_translateText(vbet_encodeToSafeUTF8($thread['meta_description']), $forumLanguage, $language, $serie);
$og_array['og:title'] = vbet_translateText(vbet_encodeToSafeUTF8($thread['title']), $forumLanguage, $language, $serie);
Find:

$og_array['og:description'] = $ogdesc;
$og_array['og:title'] = $bloginfo['title'] . ' ' . $vbphrase['posted_by'] . ' ' . $bloginfo['username'];
REPLACE it with this code (For utf-8 characters):

$og_array['og:description'] = vbet_translateText($ogdesc, $forumLanguage, $language, $serie);
$og_array['og:title'] = vbet_translateText($bloginfo['title'], $forumLanguage, $language, $serie);
REPLACE it with this code (For not utf-8 characters):

$og_array['og:description'] = vbet_translateText(vbet_encodeToSafeUTF8($ogdesc), $forumLanguage, $language, $serie);
$og_array['og:title'] = vbet_translateText(vbet_encodeToSafeUTF8($bloginfo['title']), $forumLanguage, $language, $serie) . ' ' . $vbphrase['posted_by'] . ' ' . $bloginfo['username'];;
Save change.


To integrate this product with free version of vBET:

Edit plugin AdminCP->Plugins & Products->Plugin Manager->Open Graph Description / Tile Override
Paste this code at the beginning:

require_once(DIR. '/includes/vbenterprisetranslator_functions.php');
$language = $_REQUEST['language'];
$serie = microtime(true) * 10000;
Find:

$og_array['og:description'] = $thread['meta_description'];
$og_array['og:title'] = $thread['title'];
REPLACE it with this code (For utf-8 characters):

$og_array['og:description'] = vbet_translateText($thread['meta_description'], $language, $serie);
$og_array['og:title'] = vbet_translateText($thread['title'], $language, $serie);
REPLACE it with this code (For not utf-8 characters):

$og_array['og:description'] = vbet_translateText(vbet_encodeToSafeUTF8($thread['meta_description']), $language, $serie);
$og_array['og:title'] = vbet_translateText(vbet_encodeToSafeUTF8($thread['title']), $language, $serie);
Find:

$og_array['og:description'] = $ogdesc;
$og_array['og:title'] = $bloginfo['title'] . ' ' . $vbphrase['posted_by'] . ' ' . $bloginfo['username'];
REPLACE it with this code (For utf-8 characters):

$og_array['og:description'] = vbet_translateText($ogdesc, $language, $serie);
$og_array['og:title'] = vbet_translateText($bloginfo['title'], $language, $serie);
REPLACE it with this code (For not utf-8 characters):

$og_array['og:description'] = vbet_translateText(vbet_encodeToSafeUTF8($ogdesc), $language, $serie);
$og_array['og:title'] = vbet_translateText(vbet_encodeToSafeUTF8($bloginfo['title']), $language, $serie) . ' ' . $vbphrase['posted_by'] . ' ' . $bloginfo['username'];;
Save change.

mykkal
19-06-15, 18:13
man you are awesome... thanks a bunch.

Fabiano
20-06-15, 20:24
Marcin,

Will have this adjustment in the next Release of vBET PRO?

Marcin Kalak
22-06-15, 09:38
This integration does not require code change in vBET. This code changes functions of plugin to vBET translate tags added by him.

Vetall
03-02-17, 09:36
Good day!

vBET Translator 4.7.2
vBulletin 4.2.3

Open Graph Description & Title Fix on Threads/Blog 1.2.0


Open Graph Description / Tile Override fb_opengraph_array:

if (THIS_SCRIPT == 'showthread') //For Threads
{
global $thread;
$og_array['og:description'] = $thread['meta_description'];
$og_array['og:title'] = $thread['title'];
}

if (THIS_SCRIPT == 'entry') //For Blog Entries
{
global $vbphrase, $bloginfo;
$ogdesc = strip_bbcode($bloginfo['pagetext'], true, false, false, true);
$ogdesc = htmlspecialchars ($ogdesc);
$ogdesc = preg_replace('!\s+!', ' ', $ogdesc);
$ogdesc = (strlen($ogdesc) > 303) ? substr($ogdesc,0,300).'...' : $ogdesc;
$og_array['og:description'] = $ogdesc;
$og_array['og:title'] = $bloginfo['title'] . ' ' . $vbphrase['posted_by'] . ' ' . $bloginfo['username'];
}


After integration changes:


require_once(DIR. '/includes/vbenterprisetranslator_functions.php');
require_once(DIR. '/includes/vbenterprisetranslator_functions_utils.php');
global $vbulletin;
$forumLanguage = $vbulletin->options['vbenterprisetranslator_forumlanguage'];
$language = $_REQUEST['language'];
$serie = microtime(true) * 10000;

if (THIS_SCRIPT == 'showthread') //For Threads
{
global $thread;
$og_array['og:description'] = vbet_translateText($thread['meta_description'], $forumLanguage, $language, $serie);
$og_array['og:title'] = vbet_translateText($thread['title'], $forumLanguage, $language, $serie);
}

if (THIS_SCRIPT == 'entry') //For Blog Entries
{
global $vbphrase, $bloginfo;
$ogdesc = strip_bbcode($bloginfo['pagetext'], true, false, false, true);
$ogdesc = htmlspecialchars ($ogdesc);
$ogdesc = preg_replace('!\s+!', ' ', $ogdesc);
$ogdesc = (strlen($ogdesc) > 303) ? substr($ogdesc,0,300).'...' : $ogdesc;
$og_array['og:description'] = vbet_translateText($ogdesc, $forumLanguage, $language, $serie);
$og_array['og:title'] = vbet_translateText($bloginfo['title'], $forumLanguage, $language, $serie);
}


-- get the error:



Database error in vBulletin 4.2.3:

Invalid SQL:
SELECT cache.originaltext as originaltext, cache.translated as translated FROM vbenterprisetranslator_cache_ help, vbenterprisetranslator_cache_ cache WHERE help.originaltext='******************************************' AND cache.serie=help.serie;

MySQL Error : Table 'vbenterprisetranslator_cache_' doesn't exist
Error Number : 1146

Marcin Kalak
03-02-17, 19:31
Please try to add after:

$language = $_REQUEST['language'];
following code:

if(!$language) {
$language = $forumLanguage;
}

Vetall
06-02-17, 07:07
Thanks for the reply.


Module code Open "Graph Description / Tile Override":



require_once(DIR. '/includes/vbenterprisetranslator_functions.php'); require_once(DIR. '/includes/vbenterprisetranslator_functions_utils.php'); global $vbulletin; $forumLanguage = $vbulletin->options['vbenterprisetranslator_forumlanguage']; $language = $_REQUEST['language']; if(!$language) { $language = $forumLanguage; } $serie = microtime(true) * 10000;
if (THIS_SCRIPT == 'showthread') //For Threads{ global $thread; $og_array['og:description'] = vbet_translateText($thread['meta_description'], $forumLanguage, $language, $serie); $og_array['og:title'] = vbet_translateText($thread['title'], $forumLanguage, $language, $serie);}
if (THIS_SCRIPT == 'entry') //For Blog Entries{ global $vbphrase, $bloginfo; $ogdesc = strip_bbcode($bloginfo['pagetext'], true, false, false, true); $ogdesc = htmlspecialchars ($ogdesc); $ogdesc = preg_replace('!\s+!', ' ', $ogdesc); $ogdesc = (strlen($ogdesc) > 303) ? substr($ogdesc,0,300).'...' : $ogdesc; $og_array['og:description'] = vbet_translateText($ogdesc, $forumLanguage, $language, $serie); $og_array['og:title'] = vbet_translateText($bloginfo['title'], $forumLanguage, $language, $serie);


MySQL errors -- no!
-- no translation og:description no
<meta property="og:description" content="*******

Marcin Kalak
06-02-17, 20:42
Please send me a PM access details to Admin CP and FTP. I will check what is going on there :)

Vetall
16-02-17, 06:31
Marcin Kalak, sorry, everything works fine****** :o

Marcin Kalak
16-02-17, 15:52
Thank you very much for the information.

AfrikaansAlbanianArabicBelarusianBulgarianCatalanChineseCroatianCzechDanishDutchEnglishEstonianFilipinoFinnishFrenchGalicianGermanGreekHaitian CreoleHebrewHindiHungarianIcelandicIndonesianIrishItalianJapaneseKoreanLatvianLithuanianMacedonianMalayMalteseNorwegianPersianPolishPortugueseRomanianRussianSerbianSlovakSlovenianSpanishSwahiliSwedishTaiwaneseThaiTurkishUkrainianVietnameseWelshYiddish
Multilingual forum supported by vBET Translator 4.9.2