I don't know if this belongs as a hook, but I think it would be particularly useful functionality for a variety of plugins that want to extend how posts are made.
- Name: hook_add_post_filter
- Rationale: Allows posts to be filtered and modified before inserted into the database, for example could handle URLs in a special way, censor words, and even check for spam.
- Placement: functions_posting.php
- Input arguments: the name of the added function to call (string)
- Output format: true or false based on if the function exists
- Output semantics: (see below) if the return code is false for the hook itself, it should just ignore the filter.
Code: Select all
hook_add_post_filter("my_spamcheck");
Code: Select all
function my_spamcheck(&$post_text) {
// No modifications to $post_text
// Check if $post_text is spam
if ($is_spam) {
return false; // Don't allow the post
} else {
return true; // Go ahead and post
}
}