creativeguy Posted February 26, 2022 Share Posted February 26, 2022 Hi everyone. First, my blog site is NSFW. It's a sex doll blog. FYI. I just realized today that people have been commenting away on the blog, but I didn't even know. They weren't (and still aren't) displaying on the site. I just thought no one was engaging with comments. Nope. I only realized it because I was logged in and writing a blog post. I forget why, but this time I stayed logged in to the admin and loaded a post to check something, then saw a whack of comments. But, it was half legit and half SPAM. I popped over to another browser where I wasn't logged in and there were no comments displayed. I then popped into the admin and checked the comments - sure enough they they are. But, they have been set variations of either "Pending" or "SPAM". I was seeing them all on the posts. I then checked the template - not written by me, and I'm not a developer at the level of most here - I'm a creative pro with some experience. I can't recognize a glaring problem, but obviously there is one and I can't diagnose it. On the blog-post.php template, here's the code to kick out a blog post comment and the form: <?php // blog post content echo dbbBlogPost(page()); // comments $comments = page()->comments; // comment list if(count($comments)) { echo ukHeading3("Comments", "icon=comments"); echo ukComments($comments); } // comment form echo ukHeading3("Post a comment", "icon=comment"); echo ukCommentForm($comments); // link to the next blog post, if there is one $nextPost = page()->next(); if($nextPost->id): ?> <p class='next-blog-post'> Next <?=ukIcon('chevron-right')?> <a href='<?=$nextPost->url?>'><?=$nextPost->title?></a> </p> <?php endif; ?> This is what's in the _func.php: function dbbBlogPost(Page $page, $options = array()) { $defaults = array( 'summarize' => null, // Display blog post summary rather than full post? (null=auto-detect) 'metaIcon' => 'info-circle', 'moreIcon' => 'angle-right', 'moreText' => __('Read full post'), 'categoryIcon' => 'hashtag', 'bylineText' => __('Posted by %1$s on %2$s'), ); $options = _ukMergeOptions($defaults, $options); $title = $page->title; $date = $page->get('date|createdStr'); $name = $page->post_author->title; $body = $page->get('body'); $mainImage = $page->image->url; $metaIcon = "<i class='fas fa-".$options['metaIcon']."'></i>"; $moreIcon = "<i class='fas fa-".$options['moreIcon']."'></i>"; $categoryIcon = "<i class='fas fa-".$options['categoryIcon']."'></i>"; $n = $page->get('comments')->count(); $numComments = $n ? "<a href='$page->url#comments'>" . ukIcon('comments') . " $n</a>" : ""; $gallery = ""; if($options['summarize'] === null) { // auto-detect: summarize if current page is not the same as the blog post $options['summarize'] = page()->id != $page->id; } $categories = $page->get('categories')->each($categoryIcon . "<a class='uk-button uk-button-text' href='{url}'>{title}</a> " ); if($options['summarize']) { // link to post in title, and use just the first paragraph in teaser mode $title = "<a href='$page->url'>$title</a>"; // $body = sanitizer()->truncate($body, $options['summarizeOptions']); $body = explode('</p>', $body); $body = reset($body) . ' '; $body .= "<div class='post-preview-more'><a href='$page->url'>$options[moreText] $moreIcon</a></div>"; $class = 'blog-post-summary'; } else { $class = 'blog-post-full'; } if($options['summarize']) { $heading = "<h2 class='uk-margin-remove'>$title</h2>"; } else { $heading = "<h1 class='uk-article-title uk-margin-remove'>$title</h1>"; } $byline = sprintf($options['bylineText'], $name, $date); if(!$options['summarize'] && $page->gallery) { $gallery = renderGallery($page); } // return the blog post article markup return " <article class='uk-article blog-post $class'> <img class='feature-image' src='$mainImage' alt='Post image' /> $heading <p class='uk-margin-small'> <span class='uk-article-meta'> $metaIcon $byline </span> <span class='categories'> $categories </span> </p> $body $gallery </article> <hr> "; } I also know there's a comments field with various settings, but nothing I can find there would prohibit anyone from seeing comments, nor would it specifically show a logged in user all comments including SPAM. Any guidance would be appreciated. Link to comment Share on other sites More sharing options...
kongondo Posted February 27, 2022 Share Posted February 27, 2022 (edited) 5 hours ago, creativeguy said: I also know there's a comments field with various settings, but nothing I can find there would prohibit anyone from seeing comments, nor would it specifically show a logged in user all comments including SPAM. I haven't looked at your code but the comments field is where I'd look first (with respect to comments visibility). As for a logged in user seeing all comments, you are logging in as a superuser, hence can see everything (including the comments field). Edited February 27, 2022 by kongondo Add more info Link to comment Share on other sites More sharing options...
creativeguy Posted February 27, 2022 Author Share Posted February 27, 2022 2 hours ago, kongondo said: I haven't looked at your code but the comments field is where I'd look first (with respect to comments visibility). As for a logged in user seeing all comments, you are logging in as a superuser, hence can see everything (including the comments field). Yes, I went through that as well, as I mentioned, I can't see anything in my settings that would prevent a user from seeing comments. Link to comment Share on other sites More sharing options...
kongondo Posted February 27, 2022 Share Posted February 27, 2022 (edited) 50 minutes ago, creativeguy said: I can't see anything in my settings that would prevent a user from seeing comments. It's right there in your settings ? (as per your screenshot). Under Comment moderation, your setting says All comments must be approved by someone with page-edit access. Hence the 'Pending' comments you are seeing. You need to approve them in order for them to be visible on your site for your 'guests' (commenters). Edit: If you specify an email under Admin notification email, you will get notified every time someone (or something -> spam) posts a comment on your blogs. You will be able to approve/disapprove the comment directly within your email (if you wish). Edited February 27, 2022 by kongondo added more Link to comment Share on other sites More sharing options...
creativeguy Posted February 27, 2022 Author Share Posted February 27, 2022 35 minutes ago, kongondo said: It's right there in your settings ? (as per your screenshot). Under Comment moderation, your setting says All comments must be approved by someone with page-edit access. Hence the 'Pending' comments you are seeing. You need to approve them in order for them to be visible on your site for your 'guests' (commenters). Edit: If you specify an email under Admin notification email, you will get notified every time someone (or something -> spam) posts a comment on your blogs. You will be able to approve/disapprove the comment directly within your email (if you wish). Sorry, I wasn't clear. Approved comments are not showing up on the site. Yes, I have another PW site that uses comments and it works as you describe. This site does not. No comments, approved or otherwise, appear on the site. I only see them on the site if I'm logged in. Link to comment Share on other sites More sharing options...
aagd Posted February 27, 2022 Share Posted February 27, 2022 Do you have the _uikit.php* in your templates folder? (Required to render ukComments($comments)) Do the comments appear in the page source? If so they might be just be hidden by CSS. *Edit: Which should be included in _init.php. include_once('./_uikit.php'); like in the site-regular theme in the ProcessWire Source download. Link to comment Share on other sites More sharing options...
kongondo Posted February 27, 2022 Share Posted February 27, 2022 50 minutes ago, aagd said: Do the comments appear in the page source? If so they might be just be hidden by CSS. He can see the comments if logged in, so might not be a CSS issue but an access one ?. 9 hours ago, creativeguy said: Sorry, I wasn't clear. Approved comments are not showing up on the site. Yes, I have another PW site that uses comments and it works as you describe. This site does not. No comments, approved or otherwise, appear on the site. I only see them on the site if I'm logged in. I see. Given that everyone can see other parts of the page even if not logged in (e.g. blog title, etc), this seems to suggest an access/view issue with the comments field itself. Have you checked the 'Access' tab in the comments field? Link to comment Share on other sites More sharing options...
aagd Posted February 27, 2022 Share Posted February 27, 2022 49 minutes ago, kongondo said: He can see the comments if logged in, so might not be a CSS issue but an access one ?. You're right, I assumed he just sees the comments in Admin. Link to comment Share on other sites More sharing options...
creativeguy Posted February 27, 2022 Author Share Posted February 27, 2022 Thanks both of you for the help. Actually, your dialogue back and forth got me to thinking I should check the blog post entry in the admin. I found the issue. There seems to be an error between the comments manager as a separate utility, and the comments on the page itself. The same comment that is "Approved" in the comments manager is marked "SPAM" on the blog-post page in the admin. Once I set the status inside the post VS the manager, the correct status is reflected on the site. So, there's a problem between the comments manager and the site-wide approval of the comments. Weird. Link to comment Share on other sites More sharing options...
kongondo Posted February 27, 2022 Share Posted February 27, 2022 Aha :-). 3 minutes ago, creativeguy said: So, there's a problem between the comments manager and the site-wide approval of the comments. Weird. What's the difference between this site and the other non-problematic one? If they are different with respect to ProcessWire versions and/or PHP versions, then best to file a bug report, thanks. If they are not different in this regard, then we'll need to keep digging; maybe a third party module interference, etc. Link to comment Share on other sites More sharing options...
creativeguy Posted February 27, 2022 Author Share Posted February 27, 2022 4 minutes ago, kongondo said: Aha :-). What's the difference between this site and the other non-problematic one? If they are different with respect to ProcessWire versions and/or PHP versions, then best to file a bug report, thanks. If they are not different in this regard, then we'll need to keep digging; maybe a third party module interference, etc. I'll take a look. That other site has since moved to a different platform (no longer hosted by me), but I do have an archive version. I'll pop the admin open on my local and take a look at the differences. That might take a week or so, though. I'll update this once I'm able to do that. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now