Confirmation Email Short codes

I am using a membership plug-in called WP-Members and it is furnishing me all of my required fields. Of course it provides for: user name, first name, last name, etc. This is perfect. Now when a person signs up for a yoga class, the Appointment+ plug-in has the following fields:

SITE_NAME, CLIENT, SERVICE, SERVICE_PROVIDER, DATE_TIME, PRICE, DEPOSIT, BALANCE, PHONE, NOTE, ADDRESS, CITY, EMAIL (Client's email)

How can I have the field for: FIRST_NAME & LAST_NAME included. User names are too difficult to know who the client actually is.

  • Ronald

    Thanks Jack! I went to them first (WP-Members) and here was their response:

    I understand completely - it can be troublesome to figure things out based on username alone.

    I am not familiar with the Appointment+ plugin. However, if it does give you some way of mapping fields, WP-Members stores user data in the standard WP format of "user meta". And first name/last name are WP default fields. The meta tag is 'first_name' and 'last_name'.

    IF Appointment+ pulls information from the wp_usermeta table and is configured to look for WordPress default fields, first_name last_name should do it.

  • Jack Kitterhing

    Hi there @Ronald

    I hope you are well today and sorry for the delay here, I have discussed this with the lead developer and this code will work.

    function my_app_expand_first_name ($msg, $app) {
    if (empty($app->user)) return $msg;
    $first_name = get_user_meta($app->user, 'first_name', true);
    return preg_replace('/FIRST_NAME/', $first_name, $msg);
    }
    add_filter('app_confirmation_message', 'my_app_expand_first_name', 10, 2);
    
    function my_app_expand_first_name ($msg, $app) {
    if (empty($app->user)) return $msg;
    $first_name = get_user_meta($app->user, 'first_name', true);
    return preg_replace('/FIRST_NAME/', $first_name, $msg);
    }
    add_filter('app_confirmation_message', 'my_app_expand_first_name', 10, 2);
    add_filter('app_notification_message', 'my_app_expand_first_name', 10, 2);
    add_filter('app_reminder_message', 'my_app_expand_first_name', 10, 2);

    You can place that in the functions.php of your theme :slight_smile:

    Thanks for your patience and sorry again about the delay.

    Kind Regards
    Jack.

  • Ronald

    Jack,

    Thanks for the reply. Being a novice in inserting this in to the functions.php of my theme, but I will try. The question I have from reading what you sent is where the code begins and ends. It seems like the first paragraph (if that is the correct terminology) is duplicated in the first part of the second paragraph. Is this correct? Also, would you please delineate the part that needs to actually be placed in ther, maybe in italics or bold, etc. Thank you

  • Jack Kitterhing

    Hi @Ronald

    Sorry about the confusion there, the first part wasn't meant to be included, that was just for one type of email and not all.

    Use this code exactly

    function my_app_expand_first_name ($msg, $app) {
    if (empty($app->user)) return $msg;
    $first_name = get_user_meta($app->user, 'first_name', true);
    return preg_replace('/FIRST_NAME/', $first_name, $msg);
    }
    add_filter('app_confirmation_message', 'my_app_expand_first_name', 10, 2);
    add_filter('app_notification_message', 'my_app_expand_first_name', 10, 2);
    add_filter('app_reminder_message', 'my_app_expand_first_name', 10, 2);

    That goes in the functions.php of your theme, any issues please do let me know :slight_smile:

    Thanks!

    Kind Regards
    Jack.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.