Skip to content

Instantly share code, notes, and snippets.

@scottopolis
Last active September 19, 2018 18:22
Show Gist options
  • Save scottopolis/bd55d1216296d530aa0bec086a9c3268 to your computer and use it in GitHub Desktop.
Save scottopolis/bd55d1216296d530aa0bec086a9c3268 to your computer and use it in GitHub Desktop.
AppCommunity Action Hook Example
<?php
// add this code to a plugin to modify a response
add_action('appcommunity_activity_get_item', function( $item, $retval, $request ) {
$retvalhasbadwords = false;
// check for bad words here...
if( $retvalhasbadwords ) {
// check response for bad words, and maybe send an admin email
wp_mail( get_option('admin_email'), "Bad words in activity", "Check out the recent activity from " . $request['user_id'] );
}
}, 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment