By Gary Miller on Thursday, 07 January 2016
Posted in Technical Issues
Replies 13
Likes 0
Views 1.2K
Votes 0
Hello, I am working with the developer of the popular FaLang extension to add translated content to EasyBlog 5 in Joomla 3. I have been able to configure the FaLang extension so that it sees the EasyBlog content via a few XML documents (available through other posts on your forum). The issue I ran into is that the translated content was not appearing through the front-end of my website. Stéphane, the FaLang developer, was great in that he went in and looked into the issue. From what he tells me the issue is that the EasyBlog content revision system is over-writing the translated content. This takes place is:
administrator/components/com_easyblog/includes/post/post.php around line 560:


public function checkoutFromRevision()
{
$workbench = $this->revision->getContent();

if (! $workbench) {

// somehow the revision id is exists but the revisions.content is empty.
// we need to regenerate the revisions.content.
$this->checkoutFromPost();

} else {
$this->setWorkbench($workbench);
}

$this->revision_id = $this->revision->id;
}


Stéphane's solution was to set the Workbench to Null so that the EasyBlog software would not overwrite the translated content.


public function checkoutFromRevision()
{
$workbench = $this->revision->getContent();

$workbench=null;
if (! $workbench) {

// somehow the revision id is exists but the revisions.content is empty.
// we need to regenerate the revisions.content.
$this->checkoutFromPost();

} else {
$this->setWorkbench($workbench);
}

$this->revision_id = $this->revision->id;
}

We are both wondering if there is a better way to get the same results or if this solution looks acceptable? If you have any suggestions or recommendations they would be greatly appreciated.

Thanks!
--Gary
Hey Gary,

EasyBlog only stores the content in the #__easyblog_post table for "search" purposes only. The real data is actually stored on the #__easyblog_revisions table . This is how we manage to add the revisions history for each posts. Perhaps your plugin was trying to modify the contents on the #__easyblog_post table instead?
·
Thursday, 07 January 2016 13:39
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Guys, I have implemented the code suggested and the title of the blogs are translated but not the content ...
Stephane from Falang actually sugested an even better code :

/**
* Checkout from a specific revision
*
* @since 5.0
* @access public
* @param string
* @return
*/
public function checkoutFromRevision()
{
$workbench = $this->revision->getContent();

if (JFile::exists(JPATH_ADMINISTRATOR . '/components/com_falang/classes/FalangManager.class.php')) {

$default_site_language =JComponentHelper::getParams('com_languages')->get("site","en-GB");
$JLang = JFactory::getLanguage();
$currentLanguage = $JLang->getTag;
if($currentLanguage != $default_site_language ){
$workbench=null;

}

if (! $workbench) {

// somehow the revision id is exists but the revisions.content is empty.
// we need to regenerate the revisions.content.
$this->checkoutFromPost();

} else {
$this->setWorkbench($workbench);
}

$this->revision_id = $this->revision->id;
}


Still no translation on the actual articles... PLease let me know if anyone could take a look at this and tell me what is wrong ...

Also debugging the sistem there are some errors on a couple of language ini files from easyblog. Comments etc .. any help ?

JROOT/administrator/language/en-GB/en-GB.plg_easyblog_pagebreak.ini : error(s) in line(s) 13
·
Saturday, 14 May 2016 17:46
·
0 Likes
·
0 Votes
·
0 Comments
·
Hm, I would reckon that you use the built in multi lingual setup in Joomla rather than relying on 3rd party translation tools. EasyBlog currently does not support Falang and I am not too sure how this is going to work. The codes that Stephane provided will eliminate the "revisions" feature in EasyBlog.

By the way, please remember to assign your domain to your license to obtain for support in the future. You can do so by accessing your license area at http://stackideas.com/dashboard
·
Saturday, 14 May 2016 17:57
·
0 Likes
·
0 Votes
·
0 Comments
·
Im having the same issue...
I see in the DB that there is 2 tables:
-easyblog_post
-easyblog_revisions

And both tables have post entries.
Which one is the post show in FE? and how to know which of all this is the "valid" revision? Where is this stored?
If this cause problems, is it possible to disable the revisions? I preffer to have multilingual site instead of revision history...
Thanks!
·
Thursday, 27 October 2016 18:02
·
0 Likes
·
0 Votes
·
0 Comments
·
hey Martin,

From the frontend listing, it will refer on the #__easyblog_revisions table to populate the blog content on the page.

How it actually know which blog post data it show on the frontpage, it actually base on that blog post id and the revision id from #__easyblog_posts table.

Unfortunately that was not possible to disable revisions in current system.
·
Friday, 28 October 2016 00:45
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks Arlex for the clarification
So, what happens when checkoutFromRevision() gets a NULL $workbench ?
This is the code proposed by Stephane, from Falang:


public function checkoutFromRevision()
{
$workbench = $this->revision->getContent();

//sbou
if (JFile::exists(JPATH_ADMINISTRATOR . '/components/com_falang/classes/FalangManager.class.php')) {
$default_site_language =JComponentHelper::getParams('com_languages')->get("site","en-GB");
$JLang = JFactory::getLanguage();
$currentLanguage = $JLang->getTag;
if($currentLanguage != $default_site_language ){
$workbench=null;
}
}
//fin sbou

if (! $workbench) {

// somehow the revision id is exists but the revisions.content is empty.
// we need to regenerate the revisions.content.
$this->checkoutFromPost();

} else {
$this->setWorkbench($workbench);
}

$this->revision_id = $this->revision->id;
}


So, "if (! $workbench)" what happens? It will try to fix or change anything on the DB? os simply load the content from _post table?

Regards!
·
Friday, 28 October 2016 01:50
·
0 Likes
·
0 Votes
·
0 Comments
·
Flang "gets in between" EB and DB. So when EB ask for the post, Falang return the translated content instead.

What would be the best approach to override FE revision loading when ((Falang == installed) && (Falang == Enabled))
We dont have to worry about revisions when translated content is needed, because its Falang providing this content. _post and _revisions only hold information in native language, and its not needed in this case.

Im aware that there are many interested people in this topic, as when talking with Stephane, he is having many enquiries about this. He is doing his best to provide solution. Now we need your help.
Thanks!
·
Friday, 28 October 2016 02:01
·
0 Likes
·
0 Votes
·
0 Comments
·

Thanks Arlex for the clarification
So, what happens when checkoutFromRevision() gets a NULL $workbench ?
This is the code proposed by Stephane, from Falang:



public function checkoutFromRevision()
{
$workbench = $this->revision->getContent();

//sbou
if (JFile::exists(JPATH_ADMINISTRATOR . '/components/com_falang/classes/FalangManager.class.php')) {
$default_site_language =JComponentHelper::getParams('com_languages')->get("site","en-GB");
$JLang = JFactory::getLanguage();
$currentLanguage = $JLang->getTag;
if($currentLanguage != $default_site_language ){
$workbench=null;
}
}
//fin sbou

if (! $workbench) {

// somehow the revision id is exists but the revisions.content is empty.
// we need to regenerate the revisions.content.
$this->checkoutFromPost();

} else {
$this->setWorkbench($workbench);
}

$this->revision_id = $this->revision->id;
}

So, "if (! $workbench)" what happens? It will try to fix or change anything on the DB? os simply load the content from _post table?

Thanks for getting back to us, it just do not allow system to get content from the revision table so it set $workbench valuable to null, so it will load the content from the #__easyblog_post table.


Flang "gets in between" EB and DB. So when EB ask for the post, Falang return the translated content instead.

What would be the best approach to override FE revision loading when ((Falang == installed) && (Falang == Enabled))
We dont have to worry about revisions when translated content is needed, because its Falang providing this content. _post and _revisions only hold information in native language, and its not needed in this case.

Im aware that there are many interested people in this topic, as when talking with Stephane, he is having many enquiries about this. He is doing his best to provide solution. Now we need your help.
Thanks!

Hm, currently we do not have a better way to override this in current system is because everything is rely on the revision, but regarding this situation, I will discuss with our team and see if we can do something about it in Easyblog 5.1 version.
·
Friday, 28 October 2016 17:49
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for getting back to us, it just do not allow system to get content from the revision table so it set $workbench valuable to null, so it will load the content from the #__easyblog_post table.


Can you tell me if checkout is made from post, anything gets overwritten on the DB?

I think im experiencing a problem with this modification. My post are being overwritten with the translation content. And i think this is because when workbench is null the post/revision is regenerated. But as falang return translated content instead of original, when regenerating the original is overwritten with translated... im not sure if im explaining myself

Thanks!
·
Wednesday, 02 November 2016 00:17
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Martin,

Can you tell me if checkout is made from post, anything gets overwritten on the DB?

I think im experiencing a problem with this modification. My post are being overwritten with the translation content. And i think this is because when workbench is null the post/revision is regenerated. But as falang return translated content instead of original, when regenerating the original is overwritten with translated... im not sure if im explaining myself

Thanks!

Do you mean when the admin published a blog post on the site, then he will copy all this post content then translated it from Falang.

Then it will populate correct the content on frontend.

After that, the admin decided to add some new content in the blog post again, then he also update the translation from the Falang as well, but this time the frontend post didn't show the latest content?
·
Wednesday, 02 November 2016 15:45
·
0 Likes
·
0 Votes
·
0 Comments
·
No, i mean that my post are written in spanish. And translated to english on Falang.

But for some strange reason my post are being overwritten with the content in english. I dont change anything. Just the original post was in spanish but now is in english.

I was thinking that maybe when $workbench = null in post.php something is happening that explains why my original content is overwritten with the translated content.
·
Wednesday, 02 November 2016 16:17
·
0 Likes
·
0 Votes
·
0 Comments
·
Im not talking on FE or BE...
The content is overwritten in DB
·
Wednesday, 02 November 2016 16:18
·
0 Likes
·
0 Votes
·
0 Comments
·
hey Martin,

I am sorry for the delay of this reply,

I think it would be best if you can start a new thread from our forums and include your Joomla backend and FTP access so we can directly help you check on this and see if we can figure out something or not.

And provide us some of the instruction how to replicate this.
·
Thursday, 03 November 2016 13:38
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post