Stop ACTA

Introducing two new plugins for CakePHP

Posted in CakePHP on 25.06.2012.

Did religious references in Prometheus annoy you as well? Here are some cake plugins to make you happy!

Actually, Prometheus has nothing to do with these plugins, but hell, making them took the yuckiness of the movie out of my head. I'm still pissed though.

Feedback plugin

Cake 2.x is so much better than the previous versions, and this plugin is the proof. Not because it's something fantastically amazing (it is), but because it's was actually simple to create.

So what is Feedback plugin? It enables you to plug in comments and rating stars into your existing applications with virtually no work at all, and more importantly, with virtually no modifications to your app.

How easy is it? This easy:

// step 1: model
class Post extends AppModel
{
    public $actsAs = array('Feedback.Commentable');
}

// step 2: controller
class PostsController extends AppController
{
    public $components = array
        (
            'Feedback.Comments' => array
            (
                'on' => array
                (
                    'admin_view',
                    'view'
                )
            )
        );
}

// step 3: view
echo $this->Comments->display_for($post);

It's pretty much the same for star ratings as well.

While commenting, users have the "remember my info" option so they don't have to enter it again. Also, comments also have gravatar integrated (using Goodies). For more info and instructions, view the README (lots of info there).

The only major issue at the moment is the lack of spam filter for comments, which will be solved some day by:

Naive Bayes Classifier plugin

So yes, this plugin may not be as interesting to many of you out there, but I've decided to publish it anyway. The plugin is obviously a Naive Bayes classifier.

I'm hoping to develop a pure CakePHP anti-spam plugin some day, and this plugin will certainly be a part of it. However, you don't have to use it for spam, because it's not spam-specific. You can use it for whatever your classification needs are, because it was written as a general classifier.

Again, for more info and instructions, see the README.

Article comments — View · Add


Page 1 of 3
1 · 2 · 3

Victor :: 20.02.2013 10:14:55
Hi there

I have tried to implement your Feedback plugin on my application, I am having an error on my view pages that says "Feedback.CommentsComponent could not be found". Can you please highlight where im getting lost?

Below is my code that i have used in my model,controller and view

Model Code

class ItSupportRequest extends AppModel {

public $actsAs = array('Feedback.Commentable');

/*other code*/

}

Controller code

public $components = array
(
'Feedback.Comments' => array
(
'on' => array
(
'admin_view',
'view'
)
)
);


and the view code

<?php echo $this->Comments->display_for($itSupportRequestComment); ?>

Thanks in advance.
lecterror :: 20.02.2013 18:29:07
Hi Victor,

Did you activate the plugin in your application? It's mentioned in the readme instructions in case you've missed it.
Victor :: 25.02.2013 13:00:55
Yes, i have activated the two plugins and the error that i am getting now is
Strict (2048): Declaration of CommentableBehavior::setup() should be compatible with ModelBehavior::setup(Model $model, $config = Array) [APP\Plugin\Feedback\Model\Behavior\CommentableBehavior.php, line 42]

Any idea what might be causing this?

Thanks in advance
Victor :: 25.02.2013 16:04:20
If i can have a way of removing this error message that would be awesome. Please not i didn't change my CommentableBehavior.php file were the error seems to be coming from.
lecterror :: 27.02.2013 21:05:54
Hi Victor,

I've pushed a fix for this on github, please let me know if everything is ok.

Sorry about the delay.