Keyword

How to Get ID of comment?

  • brudasven
  • brudasven's Avatar Topic Author
  • Offline
  • New Member
More
9 years 4 months ago #134409 by brudasven
How to Get ID of comment? was created by brudasven
Hey everyone,

so, i have a little Problem which i hope you guys can help me with.

I Know that i can get the ID of a K2 Article with:

$K2Itemid = JRequest::getInt('id')

Is there also a way to get the ID of a comment from this article?

Would be really happy if someone could help me out here.

Cheers,

Sven

Please Log in or Create an account to join the conversation.

More
9 years 4 months ago #134421 by Lefteris
Replied by Lefteris on topic How to Get ID of comment?
Hi. Which ID? A K2 item may have many comments.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • brudasven
  • brudasven's Avatar Topic Author
  • Offline
  • New Member
More
9 years 4 months ago #134438 by brudasven
Replied by brudasven on topic How to Get ID of comment?
Hi Lefteris,

i guess i need to give a lot more Info to you guys, so:

i'm working on a function to let user confirm that they have read an article.
This is realized by the module "qlform", which is loaded into every comment by "loadModule"
See Screenshot for Example.

So, now i need to know how to adress each comment, when a user clicks "mark as read".

I hope my explanation is understandable

Screenshot

Please Log in or Create an account to join the conversation.

More
9 years 4 months ago #134445 by Lefteris
Replied by Lefteris on topic How to Get ID of comment?
How exactly are you loading the module in each comment?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • brudasven
  • brudasven's Avatar Topic Author
  • Offline
  • New Member
More
9 years 4 months ago #134452 by brudasven
Replied by brudasven on topic How to Get ID of comment?
I added "Php Echo loadmodule NameOfModule" at the end of the comment Section in item.php
It does work when i try to get the article id, but i'm not sure how to get the comment id.

Please Log in or Create an account to join the conversation.

More
9 years 4 months ago #134454 by Lefteris
Replied by Lefteris on topic How to Get ID of comment?
Since i guess that you are already inside the comments loop the comment id is accessible with the following variable:
$comment->id

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • brudasven
  • brudasven's Avatar Topic Author
  • Offline
  • New Member
More
9 years 4 months ago #134457 by brudasven
Replied by brudasven on topic How to Get ID of comment?
Awesome! Will try this out tomorrow. Thanks :)

Please Log in or Create an account to join the conversation.

  • brudasven
  • brudasven's Avatar Topic Author
  • Offline
  • New Member
More
9 years 4 months ago #134475 by brudasven
Replied by brudasven on topic How to Get ID of comment?
so, i tried it, but it didnt work. The problem is, i'm still learning php,so i'm not exactly sure where to put the code.
The module "qlform" is accessing the variables through this code:
elseif ('article_id'==$field) $arr['value']=$K2Itemid = JRequest::getInt('id');

Since i have two "mark as read" buttons, the users can mark an article as read as well as the comments.

I tried it with this code:
elseif ('comment_id'==$field) $arr['value']=$comment->id;
but that doesn't work.
Ideas, anyone? :(

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 4 months ago #134488 by Krikor Boghossian
Replied by Krikor Boghossian on topic How to Get ID of comment?
I think you should address this issue to the extension's developer. I do not think we can provide adequate info on this extension.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum