Skip to content

Commit

Permalink
Make the post title a link in comment notification emails.
Browse files Browse the repository at this point in the history
See #3242.
  • Loading branch information
boonebgorges committed Sep 13, 2023
1 parent 532d838 commit 0cba1f5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions wp-content/plugins/wds-citytech/includes/email.php
Original file line number Diff line number Diff line change
Expand Up @@ -802,13 +802,15 @@ function ol_comment_moderation_text( $notify_message, $comment_id ) {
/**
* Adds 'Hello' and footer 'note' to comment-related emails.
*
* Also makes the post URL a link.
* Also makes the post title a link.
*/
function openlab_comment_email_boilerplate( $content, $comment_id ) {
$post_id = get_comment( $comment_id )->comment_post_ID;
$post_url = get_permalink( $post_id );
$post_id = get_comment( $comment_id )->comment_post_ID;
$post_url = get_permalink( $post_id );
$post_title = get_the_title( $post_id );

$content = str_replace( '<br />' . $post_url, '<br /><a href="' . $post_url . '">' . $post_url . '</a>', $content );
$content = str_replace( '<br />' . $post_url, '', $content );
$content = str_replace( '"' . $post_title . '"', '<a href="' . $post_url . '">' . $post_title . '</a>', $content );

return sprintf(
'Hello,' . "<br /><br />" .
Expand Down

0 comments on commit 0cba1f5

Please sign in to comment.