Customize #post_name#
-
#post_name# is currently returning “Reply To: <Post Name>” in email subject and content where I am using this #post_name# variable. Is there a way so that I can customise #post_name# and remove “Reply To:” out of #post_name# ?
The page I need help with: [log in to see the link]
-
I am not sure if you can access the given page but just want to tell you that I am using this plugin with bbpress
Sorry, I didn’t get your query. Is it possible to share a screenshot? The link given above is not accessible without login.
Please check for reference.
Please check above screenshots for reference.
Hi @manojrwlsr
Thank you for sharing the screenshot. I will check this and get back to you.
One last question:
Where are you mentioning users and getting this “Reply to” in the email subject.
Can you share the steps to follow?
I am using bbpress and in the topics, I have a reply form where community members can reply and mention @users.
ok. Thank you for providing information. I will check this and get back to you.
Thank you!
Also for #commenter_name# it is currently showing username in email but in #user_name# it is showing as user firstname and user lastname. Can I make the #commenter_name# also like #user_name# so that it pulls commenter firstname and last name?
Ho @manojrwlsr
For #post_name#, we have to use following filter to remove “Repy to”
/**
* Modifies the comment notification email subject tokens.
*
* This function is used to filter the comment notification email subject tokens.
* It replaces the 'Reply To: ' prefix from the first token in the array.
*
* @param array $tokens The array of comment notification email subject tokens.
*
* @return array The modified array of comment notification email subject tokens.
*/
function cmnt_modify_subject_tokens( $tokens ) {
$tokens[0] = str_replace( 'Reply To: ', '', $tokens[0] );
return $tokens;
}
add_filter( 'cmt_mtn_replace_email_sub_placeholders', 'cmnt_modify_subject_tokens' );
/**
* Modifies the comment notification email content tokens.
*
* This function is used to filter the comment notification email content tokens.
* It replaces the 'Reply To: ' prefix from the first token in the array.
*
* @param array $tokens The array of comment notification email content tokens.
*
* @return array The modified array of comment notification email content tokens.
*/
function cmnt_modify_content_tokens( $tokens ) {
$tokens[1] = str_replace( 'Reply To: ', '', $tokens[1] );
return $tokens;
}
add_filter( 'cmt_mtn_replace_email_placeholders', 'cmnt_modify_content_tokens' );That’s working like a charm. Thank you so much!!
However, if you could please provide me a hook to below query, that will be really helpful:
Also for #commenter_name# it is currently showing username in email but in #user_name# it is showing as user firstname and user lastname. Can I make the #commenter_name# also like #user_name# so that it pulls commenter firstname and last name?This seems like a bug. Can you share a screenshot of settings you did.
Please check the screenshot:
https://tinyurl.com/26xcxwzoCurrently I am customizing the dropdown on front end with below filter so may be that's why it is showing up "#username#" like first name + last name, but we are not modifying #comentername# that we need to make like user firstname + lastname:
function custom_bbp_breadcrumbs() {
if (bbp_is_single_user()) {
$user_id = bbp_get_displayed_user_id();
$first_name = ucwords(get_user_meta($user_id, 'first_name', true));
$last_name = ucwords(get_user_meta($user_id, 'last_name', true));
$full_name = trim($first_name . ' ' . $last_name);
$member_community_url = site_url();
echo '<div class="bbp-breadcrumb">';
echo '<p>';
echo '<a href="' . esc_url($member_community_url) . '" class="bbp-breadcrumb-root">Member Community</a> ';
echo '<span class="bbp-breadcrumb-sep">›</span> ';
echo '<span class="bbp-breadcrumb-current">' . esc_html($full_name) . '</span>';
echo '</p>';
echo '</div>';
} else {
bbp_breadcrumb();
}
}
add_filter('cmt_mntn_ajax_get_users', 'customize_user_dropdown_data', 10, 2);
function customize_user_dropdown_data($results, $args) {
foreach ($results as $result) {
$user_id = $result->user_id;
$fname = get_user_meta($user_id, 'first_name', true);
$lname = get_user_meta($user_id, 'last_name', true);
if ($fname || $lname) {
$result->name = $fname . ' ' . $lname;
$result->key = $fname . ' ' . $lname; // Ensure the key is also updated if used
}
}
return $results;
}
function customize_user_dropdown_with_email($results, $args) {
foreach ($results as $result) {
$user_id = $result->user_id;
$user_info = get_userdata($user_id);
if ($user_info) {
$result->name = $user_info->user_email;
}
}
return $results;
}
add_filter('cmt_mntn_ajax_get_users', 'customize_user_dropdown_with_email', 10, 2);Then I would recommend, try by removing your custom code.
- You must be logged in to reply to this topic.