flydev Posted February 8, 2016 Share Posted February 8, 2016 I was trying to reproduce @Zahari issue but I ran into another problem with email settings, I got an exception : Exception: Invalid email address (processwire@localhost) (in \pw\wire\core\WireMail.php line 81) WireMailSmtp is installed and correctly configured. Any idea ? Link to comment Share on other sites More sharing options...
Zahari M. Posted February 9, 2016 Share Posted February 9, 2016 hi flydev I'm not sure about your particular error. So I can't offer much advice. Sorry. But I have been spending a lot of time working on my problem. What I have discovered is that if we use the core CommentForm.php file to generate our comment form, then threaded comments work perfectly. We also need to follow the instructions in the module and make sure we are linking to the needed js file. But if we wish to create a much more customised comment form, then making a copy of CommentForm.php and placing it in our site directory as described a few times in this thread does not actually work the way we want! The comment form gets displayed, and it does submit and generate comments, yes. But the threaded functionality no longer works and I'm not sure why So if anyone knows how to make another copy of CommentForm.php, place it in our site directory and still get threaded comments to work, I would be most appreciative! In version 3.0 it seems we can make a copy of the comments module and place it in /site/modules and customise our copy there. PW seems to automatically make any core module copies placed in our sites/modules folder the active copy. So we just edit our copy. Yay! Also... does anyone know what exactly to enter into our comments date/ time format box to display our comments actual post time? I seem to be only able to show relative times Link to comment Share on other sites More sharing options...
flydev Posted February 10, 2016 Share Posted February 10, 2016 About The exception Invalid email address (processwire@localhost); She is triggered when we leave empty the configuration field "Notifications From Email". Just finished to give a try at your solution (with PW3) and everything work fine. No idea about formatting the time output atm. Have you tried editing your field in the configuration page ? It say : Link to comment Share on other sites More sharing options...
Zahari M. Posted February 10, 2016 Share Posted February 10, 2016 Hey flydev Glad you got your problem solved! Yes, I have tried adding quite a few things there. But still can't get it to work Link to comment Share on other sites More sharing options...
flydev Posted February 10, 2016 Share Posted February 10, 2016 and giving the option dateFormat directly to the function, it works for you ? exemple: $page->comments->renderAll(array('dateFormat' => 'm/d/y g:ia',)); 1 Link to comment Share on other sites More sharing options...
Zahari M. Posted February 10, 2016 Share Posted February 10, 2016 Hi flydev! Very clever & works great. Thanks! Cheers Link to comment Share on other sites More sharing options...
jannisl Posted February 20, 2016 Share Posted February 20, 2016 Hey guys, first I want to say thanks for the best cms system ever! Great job! And I love the comment system. It works great for me. But does anybody have a idea how I can echo two different versions depending on the input fields? This is my code now: <div class="content <?php if($page->isHeader == 0){echo "extraPadding";}?>"> <?php // comment form echo $page->guestbook->renderForm(array( 'headline' => "<h2>Ihr Gästebucheintrag:</h2>", 'successMessage' => "<p class='success'>Dankschön! Ihr Eintrag wurde erfolgreich gespeichert!</p>", 'errorMessage' => "<p class='error'>Leider gab es einen Fehler. Wahrscheinlich wurde ein Feld nicht ausgefüllt.</p>", 'processInput' => true, 'encoding' => 'UTF-8', 'attrs' => array( 'id' => 'CommentForm', 'action' => './', 'method' => 'post', 'class' => '', 'rows' => 5, 'cols' => 50, ), 'labels' => array( 'cite' => 'Name', 'email' => 'E-Mail', 'website' => 'Homepage', 'text' => 'Gästebucheintrag', 'submit' => 'Veröffentlichen', ), // the name of a field that must be set (and have any non-blank value), typically set in Javascript to keep out spammers // to use it, YOU must set this with a <input hidden> field from your own javascript, somewhere in the form 'requireSecurityField' => '', // not used by default )); // comments output echo $page->guestbook->render(array( 'headline' => '<h2>Einträge</h2>', 'commentHeader' => 'Geschrieben von <a href="{website}">{cite}</a> am {created}', 'dateFormat' => 'd/m/Y', 'encoding' => 'UTF-8', 'admin' => false, // shows unapproved comments if true )); ?> </div> The website of the comment author should only be a link if they have a website. Something like this: If (website == nothing){ 'commentHeader' => 'Geschrieben von {cite} am {created}' } else { 'commentHeader' => 'Geschrieben von <a href="{website}">{cite}</a> am {created}' } How can I do this? Jannis Link to comment Share on other sites More sharing options...
LostKobrakai Posted February 20, 2016 Share Posted February 20, 2016 You'd need to loop over the comments manually instead of using the render() method. This is explained in the first post of the topic under "OPTIONAL: Generating your own output". Within that loop you can have as much additional logic as you need. Link to comment Share on other sites More sharing options...
flydev Posted February 20, 2016 Share Posted February 20, 2016 You can make your own array and pass it as an argument to the render() method. A short snippet exemple for your need : $website = ""; $options = array('headline' => '<h2>Einträge</h2>'); if (strlen($website)<=0) { $temp = array('commentHeader' => 'Geschrieben von {cite} am {created}'); } else { $temp = array('commentHeader' => 'Geschrieben von <a href="{website}">{cite}</a> am {created}'); } $options = array_merge($options, $temp); $temp = array( 'dateFormat' => 'd/m/Y', 'encoding' => 'UTF-8', 'admin' => false ); $options = array_merge($options, $temp); echo $page->guestbook->render($options); // argument as Array() 2 Link to comment Share on other sites More sharing options...
jannisl Posted February 20, 2016 Share Posted February 20, 2016 Wow, this is quick help! I tried the code from flydev and it works perfect! Thanks for the quick help! Link to comment Share on other sites More sharing options...
kreativmonkey Posted March 28, 2016 Share Posted March 28, 2016 Hi Ryan, can you make the "chackNewComment" function hookable that more people can create spam filter for your comments module? Link to comment Share on other sites More sharing options...
Juergen Posted March 29, 2016 Share Posted March 29, 2016 I have tried to figure out how to change the status (spam, approved,...) via api from the email link. I have created a custom comment form and custom comment list with my markup. Both work as expected. The only thing I could not figure out was how to change the status from pending to approved or another status via the email link if it will be clicked. In the email link there are several GET variables which can be used to create an if statement. F.e if(GET->[success] == "approve"){ ..... ..... set new comment status to 1 } There are several GET variables so this makes it a little bit tricky. Has anyone tried to make the email activation of comments via the api. Best regards Link to comment Share on other sites More sharing options...
Juergen Posted April 4, 2016 Share Posted April 4, 2016 No one an idea? I have the code to check for the email approval so far. //check for email approval GET variables $cpageid = isset($_GET['page_id']) ? $_GET['page_id'] : ''; $ccode = isset($_GET['code']) ? $_GET['code'] : ''; $capprove = isset($_GET['comment_success']) ? $_GET['comment_success'] : ''; foreach($page->comments as $c) { if((($page->id) == $cpageid) AND (($c->code) == $ccode) AND ($capprove == "approve")){ //$c->setOutputFormatting(false); //$c->status = 1; //$c->save(); echo "approved"; } else { echo "not approved"; } } The checking works and it shows me "approved" if anything is ok, but I am not able to store the new status value in the db. As far as I know comments are pages. Therefore I have tried to save it as a page, but this code doesnt work. $c->setOutputFormatting(false); $c->status = 1; $c->save(); Has anyone an idea how to save a specific comment to update the status? Best regards Link to comment Share on other sites More sharing options...
Juergen Posted April 4, 2016 Share Posted April 4, 2016 I have found a working solution. Here is the code for others who are interested in. //check for email approval GET variables $cpageid = isset($_GET['page_id']) ? $_GET['page_id'] : ''; $ccode = isset($_GET['code']) ? $_GET['code'] : ''; $capprove = isset($_GET['comment_success']) ? $_GET['comment_success'] : ''; foreach($page->comments as $c) { if((($page->id) == $cpageid) AND (($c->code) == $ccode) AND ($capprove == "approve")){ $page->setOutputFormatting(false); $c->status = 1; $page->save('comments'); } } Best regards 3 Link to comment Share on other sites More sharing options...
Juergen Posted April 5, 2016 Share Posted April 5, 2016 Unfortunately the code above works only if you are logged in and click the email approval link Mabe someone knows a possible solution for this. Link to comment Share on other sites More sharing options...
Juergen Posted April 7, 2016 Share Posted April 7, 2016 Quick and dirty way to make email approval on custom comment markup. If you are using a custom markup for your comment list like Ryan describes in this post (https://processwire.com/talk/topic/696-quick-guide-to-the-comments-system/?p=386) the email approval wont work any longer. You can use your own markup and then you have to include the standard markup up too. Standard markup to render comments: <?php echo $page->comments->render(); Wrap this line of code inside a div and set the visibility of this div with CSS to hidden. Now only your custom markup is visible, but the email approval works (if you are logged in or not). At the moment I havent found another solution which works well in all cases, but if anyone has a better solution please post it here. Link to comment Share on other sites More sharing options...
Robin S Posted April 20, 2016 Share Posted April 20, 2016 Does anyone have experience with using the Comments fieldtype for large volumes of comments? When I say large volume I'm thinking of a couple of thousand comments per page. Is the Comments fieldtype suitable for this kind of usage? Pagination would be important in this situation. I've seen solutions in the forums for pagination of comments on the front-end but what about pagination in page edit? Link to comment Share on other sites More sharing options...
kongondo Posted April 20, 2016 Share Posted April 20, 2016 (edited) Pagination is not possible in the Inputfield (unless something has changed that I don't know about). For that number of comments, why not use the (new) Comments Manager? You can do your pagination there, filtering, bulk edit, etc. Edited April 20, 2016 by kongondo added link 1 Link to comment Share on other sites More sharing options...
Robin S Posted April 20, 2016 Share Posted April 20, 2016 For that number of comments, why not use the (new) Comments Manager? You can do your pagination there, filtering, bulk edit, etc. I'm probably missing something, but I don't see a way to filter the Comments Manager list by page (that the comment field is on). Link to comment Share on other sites More sharing options...
kongondo Posted April 20, 2016 Share Posted April 20, 2016 Not currently, you can't. Maybe you could submit a (pull) request to Ryan? I like the idea of sorting by page Link to comment Share on other sites More sharing options...
Zahari M. Posted April 20, 2016 Share Posted April 20, 2016 Sorting by page is a great idea and would be wonderful! Great thought there Robin!! Hope it happens one day! Link to comment Share on other sites More sharing options...
qtguru Posted October 12, 2016 Share Posted October 12, 2016 is there a way to disable email field in the comment form, as in I don't want the email form to be rendered...... Client Specific request , I know it sounds weird Link to comment Share on other sites More sharing options...
adrian Posted October 12, 2016 Share Posted October 12, 2016 2 minutes ago, Sephiroth said: is there a way to disable email field in the comment form, as in I don't want the email form to be rendered...... Client Specific request , I know it sounds weird This ancient PR (https://github.com/ryancramerdesign/ProcessWire/pull/954/files?w=1) makes several changes to the comment field for logged in users, including using local profile image, and hiding (and autofilling) the name and the email field. I know it doesn't really help you, but does let you know that others have similar needs I should maybe resubmit the PR to the new Github repo. 1 Link to comment Share on other sites More sharing options...
qtguru Posted October 12, 2016 Share Posted October 12, 2016 1 hour ago, adrian said: This ancient PR (https://github.com/ryancramerdesign/ProcessWire/pull/954/files?w=1) makes several changes to the comment field for logged in users, including using local profile image, and hiding (and autofilling) the name and the email field. I know it doesn't really help you, but does let you know that others have similar needs I should maybe resubmit the PR to the new Github repo. Thanks already altered the core code, but i am going to inform the client that disadvantage of not taking emails... really requests like this make me want to quit frontend and do Backend totally. 1 Link to comment Share on other sites More sharing options...
DV-JF Posted December 10, 2016 Share Posted December 10, 2016 Hi, I'm wondering if it's possible to change the date of the comment in backend without using the API. A customer of mine wants to adopt some comments from Facebook manually and therefore he needs to change the date? Many greets DV-JF alias Jens. 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