Skip Navigation

[Resolved] The notification email for New Messages not displaying user name and messages.

This thread is resolved. Here is a description of the problem and solution.

Problem:
The notification email for New Messages not displaying user name and messages.

Solution:
You can use Toolset forms hook 'cred_subject_notification_codes' to add custom placeholders that will hold the username and later use this custom placeholder within your notification body.

You can find the proposed solution, in this case, with the following reply:
https://toolset.com/forums/topic/the-notification-email-for-new-messages-not-displaying-user-name-and-messages/#post-1156410

Relevant Documentation:
https://toolset.com/documentation/user-guides/how-to-use-custom-placeholders-in-cred-notifications/

This support ticket is created 6 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 5 replies, has 2 voices.

Last updated by alvinc 6 years, 2 months ago.

Assisted by: Minesh.

Author
Posts
#1154433

I am trying to: I already set up the messaging system by following the step by step guide. It is working except for the email notifications - Username and message not showing. (Soemthing to do with the id)

Link to a page where the issue can be seen: This is the email notifcation body that is causing the probelm but I do not know how to edit it.

<p>Hi [wpv-user field="user_firstname" id="[types field='message-to' output='raw'][/types]"],</p>
<p>You have a message from [wpv-user field="user_firstname" id="[types field='message-from' output='raw'][/types]"] [wpv-user field="user_lastname" id="[types field='message-from' output='raw'][/types]"].</p>
<p>Message: [wpv-post-excerpt length="80" more="..."]</p>
<p>This is an automated email, please do not reply to it.</p>
<p>You can reply directly here.</p>

This is the email:

Hi [/types]“],

You have a message from [/types]“] [/types]“].

Message:

This is an automated email, please do not reply to it.

You can reply directly here.

#1154466

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Wel - could you please share problem URL where I can see and test the form and access details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#1155452

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - could you please share URL from where I can send message to listing or use the "Reply message" form. You are talking about "Reply message" form here correct?

#1155970

Hi when you Browse Listing, you will see the lister's name, all you have to do is click on the name on the top and you can send a message.

#1156410

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - as you can see with the following link, I've added custom notification placeholders:
=> hidden link


add_filter('cred_subject_notification_codes', 'custom_generic_field_notification', 10, 1);
add_filter('cred_body_notification_codes', 'custom_generic_field_notification', 10, 1);
 
function custom_generic_field_notification( $defaultPlaceHolders ) {
  
      $message_to_user_info = get_userdata($_REQUEST['wpcf-message-to']);
      $message_from_user_info = get_userdata($_REQUEST['wpcf-message-from']);
      
    $newPlaceHolders = array( 
        '%%TO_USER_FIRSTNAME%%' => $message_to_user_info->first_name,
        '%%FROM_USER_FIRSTNAME%%' => $message_from_user_info->first_name,
        '%%FROM_USER_LASTNAME%%' => $message_from_user_info->last_name,
      
    );
  
    return array_merge($defaultPlaceHolders, $newPlaceHolders );
}

More info:
=> https://toolset.com/documentation/user-guides/how-to-use-custom-placeholders-in-cred-notifications/

And I've adjusted your form's notification as given under:

<p>Hi  %%TO_USER_FIRSTNAME%%,</p>
<p>You have a message from %%FROM_USER_FIRSTNAME%% %%FROM_USER_LASTNAME%%.</p>
<p>Message: <i>[wpv-post-excerpt length="80" more="..."]</i></p>
<p><strong>This is an automated email, please do not reply to it.</strong></p>
<p>You can reply <a href="[wpv-post-url]">directly here</a>.</p>

=> hidden link

I hope now you can able to see the user first and last name for From user and first name for To user.

#1158492

My issue is resolved now. Thank you!