Problem:
The user wanted the custom user field values from a user ID passed through the generic field in the form notification.
Solution:
Suggested to use the "cred_subject_notification_codes" and "cred_body_notification_codes" filters to register custom placeholders for form notifications.
Example:
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 ) {
// get the user ID from the generic field 'evaluatee-user-id'
$target_user_ID = $_REQUEST['evaluatee-user-id'];
// get the first name and last name from the $target_user_ID
$user_first_name = do_shortcode("[wpv-user field='user_firstname' id='".$target_user_ID."']");
$user_last_name = do_shortcode("[wpv-user field='user_lastname' id='".$target_user_ID."']");
// set those first name and last name values in the custom placeholders
$newPlaceHolders = array(
'%%evaluatee_first_name%%' => $user_first_name,
'%%evaluatee_last_name%%' => $user_last_name,
);
return array_merge($defaultPlaceHolders, $newPlaceHolders );
}
Relevant Documentation:
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 |
|---|---|---|---|---|---|---|
| - | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9: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/Karachi (GMT+05:00)
This topic contains 4 replies, has 2 voices.
Last updated by 3 years, 11 months ago.
Assisted by: Waqar.