hi
It seems to work with [8548] :
when I disapprove or approve a comment, the filter is registreted and the new function of my plugin is called.
Thanks !
I have another question : I wish to verify the akismet key when the options of the plugin are saved.
There is a method of akismet to do that.
I suppose I have to do the same thing I have done for submit false positives/negatives SPAM : triggered a new function on "save" action on admin/options/comment, but I don't know which filter I could use.
could you help me ?
You would actually need a filter that is called on saving plugin options. Not sure we have one at the moment, but sbillard will know it for sure.
Edit: Is probably possible without a filter. Use the OPTION_TYPE_CUSTOM and create a check with in handleOption(). It would then work like 1. Save the key 2. on page reload this function gets that value and checks it. Then you can put out a warning right with the text field.
thanks sbillard, but could you give me an example how to add code in getSupportedOptions() ?
fyi, I have a new methoe of SpamFilter :
`
function isValidKey() {
$zp_galerieUrl = FULLWEBPATH; // Set the webpath for the Akismet server
$zp_akismetKey = getOption('Akismet_key');
$akismet = new Akismet($zp_galerieUrl, $zp_akismetKey);
if($akismet->isKeyValid()) {
return true;
} else {
return false;
}
}
`
how can I do to call this method on validation ?
how can I add a specific message on zenphoto admin : 'your Akismet key is empty or invalid' if the function returns false ?
function getOptionsSupported() { if (getOption('Akismet_key') && $this->isValidKey()) { $msg = ''; } else { $msg = Gettext('You need to provide a valid Akismet key'); } return array( gettext('Akismet key') => array('key' => 'Akismet_key', 'type' => 0, 'desc' => gettext('Proper operation requires an Akismet API key obtained by signing up for a Akismet account.').$msg), gettext('Forgiving') => array('key' => 'Forgiving', 'type' => 1, 'desc' => gettext('Mark suspected SPAM for moderation rather than as SPAM')) ); }
Here is a simple example based on your plugin. Of course the text of the message could be better, and maybe also styled as a notice.
I guess a wrong key is actually an error. We have serveral predefined class for styling you can use:
.errorbox, .warningbox and .notebox. The latter is the orange box we often use to highlight. We have also one for "successes" .messagebox which is used on successful saves for example.
thanks !
the new release of the plugin is ready.
improvement :
I have to do some testing and I will give it to the community when the 1.4.2 release of Zenphoto will be published.