Support » Plugins » modify the content of comment on submit

  • My aim is to get a comment with that format: title<!iiTITLE –>content

    I made a filter in function.php to display correctly these comments.

    I have to make one when a user submits the comment. Problem, I also use ajax. So the FORM is: `<form
    id=”awpsubmit_commentform_<?php echo $id;?>”
    action=”<?php echo get_option(‘siteurl’); ?>/wp-comments-post.php”
    onsubmit=”<?php title_filter($onsubmit);echo apply_filters(‘awp_commentform_on_submit’,$on_submit); //Leave for AWP features?>”

    the apply_filter is for ajax, which then redirect to wp_comments_post.php.

    my filters in function.php:

    global $titre;
    function comment_filter($content) {
    $i=strpos($content,'<--!TITLE -->');
    if ($i){
    $title='<h3>'.__('Without Object','stendhal').'</h3>';
    return $content;
    function ajoute_titre($content) {
    $content=$titre.'<!--TITLE -->'.$content;
    return $content;
    function title_filter($on_submit) {
    $titre = trim($_POST['titre']);

    Og course, it doesn’t work. Some help?

  • The topic ‘modify the content of comment on submit’ is closed to new replies.