• Resolved djenk

    (@djenk)


    I’ve added custom fields to my review form but don’t know how to include that info in the Notification Template. For instance, how would I include this “doctors” field in the notification email? –

    add_filter('site-reviews/config/forms/review-form', function ($config) {
        $config['doctors'] = [
            'label' => __('Who was your doctor?', 'your_theme_domain'),
            'options' => [
                'Dr. Davey' => __('Dr. Davey', 'your_theme_domain'),
                'Dr. Jim' => __('Dr. Jim', 'your_theme_domain'),
                'Dr. Detroit' => __('Dr. Detroit', 'your_theme_domain'),
            ],
            'type' => 'select',
        ];
        return $config;
    });
    • This topic was modified 4 years, 7 months ago by djenk.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Gemini Labs

    (@geminilabs)

    Adding custom fields to the form is not supported here.

    However, this should help you figure it out: https://wordpress.org/support/topic/request-post-title-in-notification-email/#post-13621690

    • This reply was modified 4 years, 7 months ago by Gemini Labs.
    Thread Starter djenk

    (@djenk)

    I already have the custom field added to the form, I just want to include the data from that custom field in the email, in essence create a template-tag for the data. The link you provided seems to be creating template tags that already exist, so I’m a little confused by what it is you’re showing me there.

    Plugin Author Gemini Labs

    (@geminilabs)

    The link I provided shows how to hook into the Site Reviews email notification to add your own template tags. For example, to add a custom template tag from a custom field:

    /**
     * @param array $data
     * @param \GeminiLabs\SiteReviews\Modules\Email $email
     * @return array
     */ 
    add_filter('site-reviews/email/compose', function ($data, $email) {
        $review = $email->data['review']; // this is the review object
        $data['template-tags']['your_custom_tag'] = $review->custom->your_field_name;
        return $data;
    }, 10, 2);

    Now you can use {your_custom_tag} in the notification template.

    • This reply was modified 4 years, 6 months ago by Gemini Labs.
    Thread Starter djenk

    (@djenk)

    THANK YOU!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom field content in notification template?’ is closed to new replies.