This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

Evenement insert comment
#1

Hi,

I have to integrate a lot of code into database when I insert a new comment.

How is it possible or where could I find the correct file.

Many thanks

Ben
Reply
#2

Hi,

I used javascript to interact with commentics, but, is there a variable for error messages ?
Or how is it possible to detect when the comment is inserted.

I tried to use cmtx_message class and id for textarea but it is not good.

Is this possible to add "id" parameter for error or success message ?

Thanks.
Reply
#3

No idea ???
Help
Reply
#4

Up Angel Blush
Reply
#5

Hi Ben,

Sorry for the late reply. If you need to make database changes whenever a comment is inserted, I think the best thing would be to modify the createComment() method in the /system/library/comment.php class.

Have you completed the interview?
Reply
#6

Hi Steven,

Many thanks for your answers, but for me, it is more simple to not change commentics libraries.
Is it possible to add an id attribute to the message in the template ?

You can see that I do here :

https://www.lamaraudiere.com/d4ua/dernie...uage=en-US

"document.getElementById("cmtx_submit_button").addEventListener("click", function(e) {

if (document.getElementById("cmtx_comment").value.length>0) {

arrDatas = {
"type" : "NEWS",
};
addNotifications(arrDatas);

}

});"
Reply
#7

I found this : <div class="cmtx_message cmtx_message_success">{{ success }}</div>
in this file : frontend\view\default\template\main\user.tpl

Is this possible to add id attribute in this line ?
I can not intercept class with getElementsByClassName()

Many thanks
Reply
#8

The user.tpl file is for the page where users manage their email preferences and subscriptions.

I think you'll need to edit the file '/frontend/view/default/javascript/common.js'.

If you search for this:
Code:
jQuery('#cmtx_form').before('<div class="cmtx_message cmtx_message_success">' + response['result']['success'] + '</div>');

You should find two instances. You'll want to modify the first instance.

Then in Extensions -> Themes, if your 'Optimize' setting is disabled, you don't need to do anything else. If it's enabled though, you'll need to use Gulp to concatenate and minify the JavaScript files. There's some documentation about that below:

https://commentics.com/build-tools

Have you completed the interview?
Reply
#9

Hi Steven,

Many thanks for your helps.

Have you an example with javascript without jquery ?
Reply
#10

I'm not sure what you mean. Commentics uses jQuery so that's what you'll need to edit.

Have you completed the interview?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)