Jump to content

Quick guide to the comments system


ryan

Recommended Posts

On 7/21/2021 at 6:43 PM, digitalbricks said:

I want to display the comments list one a cached page (ProCache) and the comments form on another, uncached page.

I'd expect that calling $cachedPage->yourcommentfield->renderForm() in your uncached page's template should do what you want.

Link to comment
Share on other sites

  • 3 months later...
  • 7 months later...
On 11/10/2017 at 8:57 AM, formmailer said:

Hi!

 

I tried to enable mail notification for users (guests), enabled "Allow commenter e-mail notifications":

image.thumb.png.cb62ae107a9b8b61f782388508c088cf.png

The option shows up on the page:

image.png.aa32f2e187e13d962bb07159f04777fc.png

But no e-mails are being sent. Is there something else I need to do?

Other mail notifications, like the admin notification for comments, are working just fine, so it's not a general e-mail issue.

 

Any help is appreciated.

 

//Jasper

 

 

hi @formmailer, it has been some time since your post but I have kind of the same issue except that even admin notifications aren't sent, did you find out how to deal with this?

Note: my comments are rendered via the customList but it is in the site/modules directory already, as suggested by @Juergen and I don't need comments approval, just email notifications to the page creator, as well as to all people who commented on the page.

I have tried those  but still didn't receive anything yet...

Any help would be greatly appreciated!

Link to comment
Share on other sites

Actually I am loading all the pages to a pop window using the jquery script

$(document).ready(function() {
    $(document).on("click", "ul.pagination li a", function(e) {
        e.preventDefault();
        //var pageurl = $(this).attr("href");
        $("div#loader").load($(this).attr("href"))});                      
});

what problem i face is when i submit a comment in a page, the url changes to some thing like

http://localhost/myblogs/?comment_success=1#CommentPostNote

so as result the page layout changes to the template layout of myblogs which doesn't include head and footer..

so how can i make sure the redirection url of the comment submission loads to the div id "loader"

Your help is very much appreciated... thank you

Link to comment
Share on other sites

  • 4 weeks later...

Hi @Chandini, if I understand correctly, you want to redirect to a specific url after posting the comment instead of:

http://localhost/myblogs/?comment_success=1#CommentPostNote

To change the success redirect url I went into the CommentForm.php file from the module.
You should find this :

$this->wire('session')->redirect($url);

Replace this with the url you want:

$this->wire('session')->redirect("./#loader");

 

And yes it is possible to get all comments into another page.

2 hours ago, Chandini said:

is it possible to get the all comments in a particular template? irrespective to the page associated with the template.

I would do something similar to this, first find all pages with the template having the comments field, for each one of them get the comments field, then for each comment, if it is approved and published, retrieve the data you need (cite, url, date, text, votes, stars,...) and echo them the way you need :

foreach($pages->find("template=yourTemplatewithComments") as $pageComment){
    foreach($pageComment->get('comments') as $comment) {
        if($comment->status < 1) continue; 
        //get what you need
        $cite = htmlentities($comment->cite);  
        $commentUrl = $comment->url;
        $date = date('m/d/y g:ia', $comment->created); // format the date
        $text = htmlentities($comment->text);
        // do something
    }
}

Let me know if that works for you

  • Like 1
Link to comment
Share on other sites

thank you for your kind reply.. I am using the same code as above. but the problem is it will output all comments if the first page, then all comments of second page as like that..

this will not generate a output which is of the order of latest comments.. irrespective of the page of same template.

 

Link to comment
Share on other sites

  • 2 weeks later...

hi friends, I am trying to paginate the comments, below is my code

$limit = 3;
$start = ($input->pageNum-1) * $limit; 
$selector = "template=gallery, sort=-created, start=$start, limit=$limit"; 

$comments = FieldtypeComments::findComments("comments", $selector);
print_r($comments);

echo $comments->render();

if($input->pageNum > 1) echo "<a href='./page" . ($input->pageNum-1) . "'>Back</a> ";
if(count($comments) > $limit) echo "<a href='./page" . ($input->pageNum+1) . "'>Next</a>"; 

this render the comments but there is no next page link showing.

print_r shows there are 8 comments

ProcessWire\CommentArray Object ( [count] => 3 [total] => 8 [start] => 0 [limit] => 3 [pager] => 1 to 3 of 8 [items] => Array ( [Comment:0] => 163 [Comment:1] => 162 [Comment:2] => 161 ) [extraData] => Array ( [selectors] => ProcessWire\Selectors Object ( [count] => 4 [items] => Array ( [SelectorEqual:0] => Array ( [field] => template [operator] => = [value] => gallery [string] => template=gallery ) [SelectorEqual:1] => Array ( [field] => sort [operator] => = [value] => -created [string] => sort=-created ) [SelectorEqual:2] => Array ( [field] => start [operator] => = [value] => 0 [string] => start=0 ) [SelectorEqual:3] => Array ( [field] => limit [operator] => = [value] => 3 [string] => limit=3 ) ) [string] => template=gallery, sort=-created, start=0, limit=3 ) ) )

please help

Thank you

NB : how to get the "featured" comments for a particular $page ? my earlier question

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...