Support » Allgemeine Fragen » Admin Kommentar Email Anpassen

  • Hey Leute, ich habe ein Problem. Wenn ein User einen Kommentar absendet, bekommt der Admin (oder alle die als admin im wp eingetragen sind) eine Email. Dies Funktionier bei uns wunderbar. Nun haben wir unser Kommentarfeld etwas angepasst und paar sachen wurden entfernt. (URL). Hinzugekommen ist der Nachname und und eine Checkbox. Soweit alles super.

    Wir wollen die Email welche wp sendet wenn ein User das Kommentarfeld ausfüllt und absendet Modifizieren oder anpassen. Hierfür wollte ich folgende code nutzen:

    
    function comment_moderation_text( $notify_message, $comment_id ){
        // get the current comment and post data
        $comment = get_comment( $comment_id );
        $post = get_post( $comment->comment_post_ID );
    
        // don't modify trackbacks or pingbacks
        if( '' == $comment->comment_type ){
            // build the new message text
            $notify_message  = sprintf( __( 'New comment on your post "%s"' ), $post->post_title ) . "\r\n";
            $notify_message .= sprintf( __('Author : %1$s'), $comment->comment_author ) . "\r\n";
            $notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n";
            $notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";
            $notify_message .= __('You can see all comments on this post here: ') . "\r\n";
            $notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n";
            $notify_message .= sprintf( __('Permalink: %s'), get_comment_link( $comment_id ) ) . "\r\n";
            $notify_message .= __('dein Testkommentar: '). "\r\n";
    
            $notify_message .= sprintf(__('datenschutz: %s'), 'Ich willige in die Veröffentlichung meiner Frage, meines Vornamens, dem ersten Buchstaben meines Nachnamens und meines Anfragezeitpunktes auf der Webseite Wolfsblut.com und den Facebook-Seiten der Healthfood24 GmbH ein.');
            $notify_message .= current_time();
    
            if ( user_can( $post->post_author, 'edit_comment', $comment_id ) ) {
                if ( EMPTY_TRASH_DAYS )
                    $notify_message .= sprintf( __('Trash it: %s'), admin_url("comment.php?action=trash&c=$comment_id") ) . "\r\n";
                else
                    $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=delete&c=$comment_id") ) . "\r\n";
                $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=spam&c=$comment_id") ) . "\r\n";
            }
        }
        // return the notification text
        return $notify_message;
    
    }
    add_filter( 'comment_notification_text', 'comment_moderation_text', 10, 2 );
    

    Jedoch egeal ob ich es in einem Plugin einfüge oder in die Functions.php des Themes greift der filter nicht bei der Administrations EMail. Kann mir vielleiht jemand helfen wie ich die Admin Email, genauer gesagt, den notify_message teil anpassen kann?

    Vielen für die Hilfe im Voraus.

  • Das Thema „Admin Kommentar Email Anpassen“ ist für neue Antworten geschlossen.