最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugin development - Events Manager: Create custom Placeholder for use in Email notification

programmeradmin2浏览0评论

I have written a function (child-theme; functions.php) for the plugin Event-Manager in Wordpress. This function reads values out of custom input fields and saves those in the databse.

I would like to write a custom Placeholder in order to place it in the email notification.

The function is:

function em_save_custom_event_fields() {
    global $EM_Booking;
    if(!empty($_REQUEST['user_motorcycle'])) {
        $EM_Booking->booking_meta['registration']['user_motorcycle'] = wp_kses($_Request['user_motorcycle'], array());
    }
}
add_filter('em_booking_add, em_save_custom_event_fields');

For the email notification I would like to add a new placeholder called #_USERMOTORCYCLE in the template that actually replaces the placeholder with the value that was provided by the user and stored at:

$EM_Booking->booking_meta['registration']['user_motorcycle']

I have searched the web and found some samples but as a novice I am not able to apply them to my requirements.

Create a Custom Placeholder for Event Formatting
and
Show specific database value in notification email

I have written a function (child-theme; functions.php) for the plugin Event-Manager in Wordpress. This function reads values out of custom input fields and saves those in the databse.

I would like to write a custom Placeholder in order to place it in the email notification.

The function is:

function em_save_custom_event_fields() {
    global $EM_Booking;
    if(!empty($_REQUEST['user_motorcycle'])) {
        $EM_Booking->booking_meta['registration']['user_motorcycle'] = wp_kses($_Request['user_motorcycle'], array());
    }
}
add_filter('em_booking_add, em_save_custom_event_fields');

For the email notification I would like to add a new placeholder called #_USERMOTORCYCLE in the template that actually replaces the placeholder with the value that was provided by the user and stored at:

$EM_Booking->booking_meta['registration']['user_motorcycle']

I have searched the web and found some samples but as a novice I am not able to apply them to my requirements.

Create a Custom Placeholder for Event Formatting
and
Show specific database value in notification email

Share Improve this question edited Nov 1, 2019 at 12:37 fuxia 107k39 gold badges255 silver badges459 bronze badges asked Nov 1, 2019 at 12:10 DanielDaniel 101
Add a comment  | 

1 Answer 1

Reset to default 0

Struggling with the same issue at the moment. It seems that placeholders are scattered everywhere through the plugin files making it a little difficult to reproduce.

Edit: Alright, it seems that there might be an easier way though I'm sure you might need to keep looking for something better. Go to the events-manager/classes folder, and open em-booking.php. In the output function you can add your own placeholder. Something along the lines of:

     case '#_USERMOTORCYCLE':
                $replace = $this->get_person()->user_motorcycle;
                break;

That should do the trick for now.

发布评论

评论列表(0)

  1. 暂无评论