eZ Community » Forums » Extensions » ezcomments 1.3.0-dev and wrong...
expandshrink

ezcomments 1.3.0-dev and wrong language_id

ezcomments 1.3.0-dev and wrong language_id

Wednesday 05 October 2011 12:29:09 pm - 12 replies

Hi,
I am using eZ Publish version 2011.9 with eZ Comments ver. 1.3.0-dev. I have a problem wiht fetching all comments for object.
When a user add a comment in ezcomment tabel everything looks fine. The language_id column has value set to 2, status 1 and correct content object id.
I can't figure out why for same objects in my installation eZ Publish show comments and for some doesn't. I see in Debug output, that for some object, SQL debug output build query with language_id = 2 (this is correct) and for another language_id =3 (it doesn't work).
I have only one language in my installation and ezcomment table has correct value. Could you help me and tell me why for some object ezcomment build query with wrong language_id?
Thanks!

Wednesday 05 October 2011 1:56:18 pm

Hello Pit,

Can you select ezcontent_language table to get language whose id=3? (select * from ezcontent_language where id=3)

Wednesday 05 October 2011 2:04:59 pm

Hi Chen,

My ezcontent_language tabel has anly one row:

disabled = 0
id =2
locale=pol-PL

Wednesday 05 October 2011 6:09:22 pm

It's really weird. Can you put debug code into ezcomments/classes/ezcomcomment.php, and see the output in language_id=3 page?

like this:

function fetchByContentObjectID( ... )

{

eZDebug::writeError( '*******language ID: ' . $languageID );

...

}

 

Wednesday 05 October 2011 8:12:05 pm

Your idea is good happy.gif Emoticon The debug output is:

*******language ID: 3

So, the next question is, why eZ Publish return wrong languageID?

This object (which has a comment) in ezcontentobject tabel has initial_language_id = 2 and language_mask =3. I don't know why but some of my objects have language_mask equal 2 and some of them 3.

Modified on Wednesday 05 October 2011 8:39:58 pm by Pit W.

Thursday 06 October 2011 5:47:34 am

This languageid is from attribute, which is from the object.

I think I got some clue, if you "select * from ezcontentobject where language_mask=3" you will get some object, even if you only have one language..

Thursday 06 October 2011 9:42:41 am

Chen, You're right. Your query returns 49 objects. All of them have initial_language_id = 2 and language_mask = 3.

I'm not an eZ Publish developer yet and I don't know what is diferent between language_id and language_mask. Actually I don't understand why the fetch function for comments does not show comment for my object if his language_id is set to 2.

Could you explain me that?

Thanks!

Thursday 06 October 2011 4:01:29 pm

Hello Pit,

I think this is a bug.

language_mask equals 3 when the class's language is one and "always_available" attribute(in admin user interface it's called "Default object availability"blunk.gif Emoticon is true.

 

 

Thursday 06 October 2011 4:25:22 pm

Proposed fix:

Replace design/standard/templates/content/datatype/view/ezcomcomments.tpl line 13

{def $language_id = $attribute.language_id}

with:

{def $language_id = $attribute.language.id}

Friday 07 October 2011 10:39:16 am

Chen, once again thanks happy.gif Emoticon

Unfortunatly new variable $attribute.language.id has the same value - equale 3 instead 2.

If I set:

{def $language_id = 2}

it works :/

Wednesday 09 November 2011 8:14:58 pm

This is a bug I am getting as well. Instead of: 

{def $language_id = $attribute.language.id} 

Which doesn't work, I did:

{def $language_id = $attribute.object.current_language_object.id}

This way I get all the comments for the current language id. Works great! Although this should be addressed by eZ.

Monday 11 February 2013 6:56:45 pm

@Chen: Why is not eZComments on Github updated with Tylers fix?

https://github.com/ezsystems/ezcomments/blob/master/packages/ezcomments_extension/ezextension/ezcomments/design/standard/templates/content/datatype/view/ezcomcomments.tpl

{def $contentobject = $attribute.object}
{def $language_id = $attribute.language_id}
{def $language_code = $attribute.language_code}

Modified on Monday 11 February 2013 6:58:10 pm by Gerhard Sletten

Monday 11 February 2013 7:12:38 pm

@Gerhard,

Sorry my fault to not push the fix(forgot). I will review this and push it this week(added to my todolist..).

Thanks for this.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from