Re: how to add a controller function to approve comments??
The simplest way is to have the approve method, when called: - perform the DB update, - set a flash message, - redirect back to the originating page (the refferer, usually available in a controller via the referrer() method). You should also make the links mini forms that do HTTP POST requests rather than GET requests, to prevent against amateur URL hacking, etc. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: how to add a controller function to approve comments??
Thank you, I've managed to make it work using the code below: function approve($id) { $this-Comment-id = $id; if($this-Comment-saveField('visible',1)) $this-flash('This comment has been approved','/comments/ moderate'); } I'm not sure about the mini forms for security you're talking about, could you give an example or explain it?? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: how to add a controller function to approve comments??
Sorry, I should have been clearer - I'm just referring to you using a HTTP GET request to call the approve function, rather than a POST using a html form. It's no big deal :) Also, fyi, you can also use the Session component to redirect to a pge and have the flash message appear on that page, rather than the 'see a message, wait for redirect; functionality that you get from the flash method you're currently using. Just some food for thought... Wood On Feb 25, 6:43 pm, jelmer [EMAIL PROTECTED] wrote: Thank you, I've managed to make it work using the code below: function approve($id) { $this-Comment-id = $id; if($this-Comment-saveField('visible',1)) $this-flash('This comment has been approved','/comments/ moderate'); } I'm not sure about the mini forms for security you're talking about, could you give an example or explain it?? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---