Skip to content

Instantly share code, notes, and snippets.

@willybahuaud
Last active December 17, 2015 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willybahuaud/5641762 to your computer and use it in GitHub Desktop.
Save willybahuaud/5641762 to your computer and use it in GitHub Desktop.
Les codes suivants servent à overider et modifier le comportement du plugin WordPress "Mention comment's Authors"
// dequeue styles
add_filter( 'mca-load-styles', '__return_false' );
// dont send notifications
add_filter( 'mca_send_email_on_mention', '__return_false' );
// dont send notifications to user which already subscribe
add_filter( 'mca_filter_recipient','dont_send_user_who_already_subscribe', 100, 2 );
function dont_send_user_who_already_subscribe( $recipients, $comment ) {
global $wpdb;
$su = $wpdb->get_results( "
SELECT comment_author
FROM {$wpdb->comments}
WHERE comment_subscribe = 'Y'
AND comment_post_ID = {$comment->comment_post_ID};", ARRAY_N );
foreach( $su as $val )
if( array_key_exists( sanitize_title( $val ), $recipients ) )
unset( $recipients[ sanitize_title( $val ) ] );
return $recipients;
}
// enable ajax mod
add_filter( 'mcaajaxenable', '__return_true' );
mcaAjaxChange();
// Personnaliser le corps sujets des emails
add_filter( 'mca-email-subject', 'my_email_subject', 15 ,5 );
function my_email_subject( $subject, $comment, $name, $mail, $titre ) {
// do stuff...
return $subject;
}
// Personnaliser le corps des emails
add_filter( 'mca-email-message', 'my_email_message', 15 ,5 );
function my_email_message( $message, $comment, $name, $mail, $titre ) {
// do stuff...
return $message;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment