Pages (5): 1 2 3 4 5   
Member
Member
vincent3569   23-09-2011, 22:09
#1

hi

on http://akismet.com/development/ I have found an Akismet php5 class.

but the akismet plugin for zenphoto uses an Akismet php4 class.

so I have decided to create a new akismet plugin for zenphoto, using this php5 class.

after some tests, it seems to work well.

can you explain , how can I give it to the community ?

Member
Member
sbillard   23-09-2011, 22:42
#2

Specially if you are intending to continue to support the plugin we would suggest you create a web page for it and we will link the entry to that site.

Otherwise you can provide the new version attached to a ticket.

Administrator
Administrator
acrylian   24-09-2011, 07:51
#3

Vincent: As said on the other thread, it would be great if you could take it over. Info on how we suggest to do that here: http://www.zenphoto.org/news/general-contributor-guidelines#themes-and-plugins

Member
Member
vincent3569   29-11-2011, 11:15
#4

hi

akismet allows to give feedback on messages and gives alert on no detected SPAM.

with another user of zenphoto, we wish to implement those functions on akismet plugin.
to do that, I need some improvement on admin-comment.php : if the admin check the message as a spam, use a new method of the plugin (feedbackMessage for exemple).

I will create a ticket for that, but first, I have a question : how the bulk action works in that case ?
Could you explain how it works ? Is there a "while loop" on each element ?

Member
Member
sbillard   29-11-2011, 19:05
#5

Bulk actions do indeed perform a while loop on the individual checked items performing the action specified.

Note that there is are filters comment_approve and comment_disapprove that you can attach with the plugin.

Member
Member
vincent3569   29-11-2011, 22:35
#6

mhh,
unfortunatly, I dont' realy inderstand how the filters work.
If you could give me some explanation (or link to to some documentation)

Member
Member
sbillard   30-11-2011, 00:53
#7

The general documentation is here: http://www.zenphoto.org/news/zenphoto-plugin-architecture#filters

The list of filters there represents 1.4.1 so there will be an update for the 1.4.2 additions. (The comment filters are there on 1.4.1)

So the quick tutorial is:

add a line in your spam filter towards the front that reads someting like:

zp_register_filter('comment_disapprove', 'plugin_handler_function');

Then declare a function:
function plugin_handler_function($commentObj) { //do your code here return $commentObj; }

Member
Member
vincent3569   30-11-2011, 09:08
#8

ok

there is the basic structure of the akismet plugin :

`
zp_register_filter('comment_disapprove', 'submitSpam');

class SpamFilter {
function SpamFilter() {
[...]
}

function getOptionsSupported() {
    [...]
}

function handleOption($option, $currentValue) {
    [...]
}

function filterMessage($author, $email, $website, $body, $receiver, $ip) {
    [...]
}

function submitSpam($comment) {
    [...]
}

}

class Akismet {
[...]
}
`
according to you, I am on the right way ?
there is no code to add in admin-comment.php or other core files ?

why the return of the $commentObj is needed ?

Administrator
Administrator
acrylian   30-11-2011, 10:49
#9

The call to the class method from the filter will not work. You call it as a function but it is a class method. You probably need a wrapper function for that method outside the class. Not sure if you can use $classobj->submitSpam within hte filter call. sbillard will know.

Quote:why the return of the $commentObj is needed ?
You mean in the filter? You can call a filter multiple times so someone else may want to use it as well.

Member
Member
vincent3569   30-11-2011, 11:42
#10

thanks

do you think the following code is more correct ?

function submitSpam calls the method feedbackMessage of SpamFilter.

feedbackMessage invokes the method submitSpam of Akismet

`
zp_register_filter('comment_disapprove', 'submitSpam');

function submitSpam($comment) {
[...]
$spamfilter = new SpamFilter();
$spamfilter->feedbackMessage($author, $email, $website, $body, false);
return $comment;
}

class SpamFilter {
function SpamFilter() {
[...]
}

function getOptionsSupported() {
    [...]
}

function handleOption($option, $currentValue) {
    [...]
}

function filterMessage($author, $email, $website, $body, $receiver, $ip) {
    [...]
}

function feedbackMessage($author, $email, $website, $body, $goodMessage) {
    [...]
    if (!($goodMessage)) {
        $akismet->submitSpam();
    }
}

}
`

Pages (5): 1 2 3 4 5   
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.