Frontier Post – Change moderation comments using Filter
Below is an example of how you can make your own moderation comments using filter – Add the below code to your functions.php and adapt it to your liking:
Requires: Frontier Post version 4.4.1 or above
function fp_my_mod_cmt( $fp_moderation_comments_new, $fp_moderation_comments_old, $my_post, $tmp_task_new, $formdata )
{
global $current_user;
$fp_my_cmts = mysql2date( 'd-m-Y', $my_post->post_date);
$fp_my_cmts .= " USER: ".$current_user->user_firstname." ".$current_user->user_lastname.":<br>";
$fp_my_cmts .= $fp_moderation_comments_new."<br>";
$fp_my_cmts .= '<hr>'."<br>";
$fp_my_cmts .= $fp_moderation_comments_old."<br>";
return $fp_my_cmts;
}
add_filter( 'frontier_post_mod_cmt_update', 'fp_my_mod_cmt', 20, 5 );
below is the code for the filter:
//***************************************************************************************
//* Save post moderation fields
//***************************************************************************************
if ( fp_get_option_bool("fps_use_moderation") && (current_user_can("edit_others_posts") || $current_user->ID == $my_post->post_author))
{
if (isset($_POST['frontier_post_moderation_new_text']))
{
$fp_moderation_comments_new = $_POST['frontier_post_moderation_new_text'];
//$fp_moderation_comments_new = trim(stripslashes(strip_tags($fp_moderation_comments_new)));
$fp_moderation_comments_new = wp_strip_all_tags($fp_moderation_comments_new);
$fp_moderation_comments_new = nl2br($fp_moderation_comments_new);
$fp_moderation_comments_new = stripslashes($fp_moderation_comments_new);
$fp_moderation_comments_new = trim($fp_moderation_comments_new);
if (strlen($fp_moderation_comments_new) > 0)
{
global $current_user;
//$tmp_date_format = fp_get_option('fps_date_format_lists', 'Y-m-d');
$fp_moderation_comments_old = get_post_meta( $my_post->ID, 'FRONTIER_POST_MODERATION_TEXT', true );
//$fp_moderation_comments = current_time( 'mysql')." - ".$current_user->user_login.":<br>";
$fp_moderation_comments = mysql2date(fp_get_option('fps_date_format_lists', 'Y-m-d'), $my_post->post_date);
$fp_moderation_comments .= " - ".$current_user->user_login.":<br>";
$fp_moderation_comments .= $fp_moderation_comments_new."<br>";
$fp_moderation_comments .= '<hr>'."<br>";
$fp_moderation_comments .= $fp_moderation_comments_old."<br>";
//****************************************************************************************************
// Apply filter before update of moderation comments
// filter: frontier_post_mod_cmt_update
// $fp_moderation_comments_new New comments entered by the users
// $fp_moderation_comments_old Previous Comments
// $my_post Post record object
// $tmp_task_new Equals true if the user is adding a post
// $_POST Input form
// FRONTIER_POST_MODERATION_TEXT in $_POST is where the moderation momments are enterd
//****************************************************************************************************
$fp_moderation_comments = apply_filters( 'frontier_post_mod_cmt_update', $fp_moderation_comments_new, $fp_moderation_comments_old, $my_post, $tmp_task_new, $_POST );
update_post_meta( $my_post->ID, 'FRONTIER_POST_MODERATION_TEXT', $fp_moderation_comments );
update_post_meta( $my_post->ID, 'FRONTIER_POST_MODERATION_DATE', current_time( 'mysql'));
update_post_meta( $my_post->ID, 'FRONTIER_POST_MODERATION_FLAG', 'true');
// Email author on moderation comments
if (isset($_POST['frontier_post_moderation_send_email']) && $_POST['frontier_post_moderation_send_email'] == "true")
{
$to = get_the_author_meta( 'email', $my_post->post_author );
$subject = __("Moderator has commented your pending post", "frontier-post")." (".get_bloginfo( "name" ).")";
$body = __("Moderator has commented your pending post", "frontier-post").": ".$my_post->post_title ." (".get_bloginfo( "name" ).")"."\r\n\r\n";
$body .= "Comments: ".$_POST['frontier_post_moderation_new_text']."\r\n\r\n";
if( !wp_mail($to, $subject, $body ) )
frontier_post_set_msg(__("Message delivery failed - Recipient: (", "frontier-post").$to.")");
}
}
}
}
.

Comments
Frontier Post – Change moderation comments using Filter — No Comments
Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in /var/www/wpfrontier.com/public_html/wp-content/plugins/frontier-buttons/include/frontier-buttons-hooks.php:395 Stack trace: #0 /var/www/wpfrontier.com/public_html/wp-content/plugins/frontier-buttons/include/frontier-buttons-hooks.php(395): implode(Array, ',') #1 /var/www/wpfrontier.com/public_html/wp-includes/class-wp-hook.php(324): frontier_buttons_teeny_init(Array, 'comment') #2 /var/www/wpfrontier.com/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array) #3 /var/www/wpfrontier.com/public_html/wp-includes/class-wp-editor.php(804): apply_filters('teeny_mce_befor...', Array, 'comment') #4 /var/www/wpfrontier.com/public_html/wp-includes/class-wp-editor.php(312): _WP_Editors::editor_settings('comment', Array) #5 /var/www/wpfrontier.com/public_html/wp-includes/general-template.php(3971): _WP_Editors::editor('', 'comment', Array) #6 /var/www/wpfrontier.com/public_html/wp-content/plugins/frontier-buttons/include/frontier-buttons-hooks.php(468): wp_editor('', 'comment', Array) #7 /var/www/wpfrontier.com/public_html/wp-includes/class-wp-hook.php(324): frontier_buttons_comments_editor(Array) #8 /var/www/wpfrontier.com/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array) #9 /var/www/wpfrontier.com/public_html/wp-includes/comment-template.php(2681): apply_filters('comment_form_de...', Array) #10 /var/www/wpfrontier.com/public_html/wp-content/themes/weaver-xtreme/comments.php(89): comment_form() #11 /var/www/wpfrontier.com/public_html/wp-includes/comment-template.php(1631): require('/var/www/wpfron...') #12 /var/www/wpfrontier.com/public_html/wp-content/themes/weaver-xtreme/single.php(55): comments_template('/comments.php', true) #13 /var/www/wpfrontier.com/public_html/wp-includes/template-loader.php(113): include('/var/www/wpfron...') #14 /var/www/wpfrontier.com/public_html/wp-blog-header.php(19): require_once('/var/www/wpfron...') #15 /var/www/wpfrontier.com/public_html/index.php(17): require('/var/www/wpfron...') #16 {main} thrown in /var/www/wpfrontier.com/public_html/wp-content/plugins/frontier-buttons/include/frontier-buttons-hooks.php on line 395