- Posts: 12
COMMUNITY FORUM
How to Get ID of comment?
- brudasven
-
Topic Author
- Offline
- New Member
Less
More
10 years 5 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
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.
- Lefteris
-
- Offline
- Platinum Member
Less
More
- Posts: 8743
10 years 5 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.
Please Log in or Create an account to join the conversation.
- brudasven
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 12
10 years 5 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
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.
- Lefteris
-
- Offline
- Platinum Member
Less
More
- Posts: 8743
10 years 5 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?
Please Log in or Create an account to join the conversation.
- brudasven
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 12
10 years 5 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.
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.
- Lefteris
-
- Offline
- Platinum Member
Less
More
- Posts: 8743
10 years 5 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
Please Log in or Create an account to join the conversation.
- brudasven
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 12
10 years 5 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
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 12
10 years 5 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:
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:but that doesn't work.
Ideas, anyone? :(
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;
Ideas, anyone? :(
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 5 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.
Please Log in or Create an account to join the conversation.