public static function cp_mp_order_notification_body($content, $order) { if ('3.0' === self::get_base() && !is_object($order) && !empty($order)) { $order = new MP_Order($order); } if (cp_get_order_course_id($order->ID)) { $course_id = cp_get_order_course_id($order->ID); $course = new Course($course_id); $tags = array('CUSTOMER_NAME', 'BLOG_NAME', 'LOGIN_ADDRESS', 'WEBSITE_ADDRESS', 'COURSE_ADDRESS', 'COURSE_TITLE', 'ORDER_ID', 'ORDER_STATUS_URL'); $course_title = ''; $course_address = ''; $order_name = ''; $tracking_url = ''; switch (self::get_base()) { case '3.0': $cart = $order->get_cart(); $items = $cart->get_items(); $order_post = get_post($order->ID); $course_title = ''; $course_address = ''; $order_name = $order->get_meta('mp_billing_info->first_name') . ' ' . $order->get_meta('mp_billing_info->last_name'); $counter = 0; foreach ($items as $product_id => $qty) { $counter += 1; $course_id = (int) get_post_meta($product_id, 'course_id', true); $course_title .= get_post_field('post_title', $course_id); $course_address .= get_permalink($course_id); if (count($items) > 0 && $counter !== count($items)) { $course_title .= ', '; $course_address .= ', '; } } $tracking_url = apply_filters('wpml_marketpress_tracking_url', mp_orderstatus_link(false, true) . $order_post->post_title . '/'); break; case '2.0': $order_name = $order->mp_shipping_info['name']; $course_address = $course->get_permalink(); $course_title = $course->details->post_title; $tracking_url = apply_filters('wpml_marketpress_tracking_url', mp_orderstatus_link(false, true) . $order->post_title . '/'); break; } $tags_replaces = array($order_name, get_bloginfo(), cp_student_login_address(), home_url(), $course_address, $course_title, $order->ID, $tracking_url); $message = coursepress_get_mp_order_content_email(); $message = str_replace($tags, $tags_replaces, $message); add_filter('wp_mail_from', 'my_mail_from_function', 99); if (!function_exists('my_mail_from_function')) { function my_mail_from_function($email) { return coursepress_get_mp_order_from_email(); } } add_filter('wp_mail_from_name', 'my_mail_from_name_function', 99); if (!function_exists('my_mail_from_name_function')) { function my_mail_from_name_function($name) { return coursepress_get_mp_order_from_name(); } } return $message; } else { return $content; } }
</tr> <tr> <th><?php _e('E-mail Content', 'cp'); ?> </th> <td> <p class="description"><?php _e('These codes will be replaced with actual data: CUSTOMER_NAME, BLOG_NAME, LOGIN_ADDRESS, COURSES_ADDRESS, WEBSITE_ADDRESS, COURSE_ADDRESS, ORDER_ID, ORDER_STATUS_URL', 'cp'); ?> </p> <?php $editor_name = "option_mp_order_content_email"; $editor_id = "option_mp_order_content_email"; $editor_content = stripslashes(coursepress_get_mp_order_content_email()); $args = array("textarea_name" => $editor_name, "textarea_rows" => 10, 'wpautop' => true); // Filter $args before showing editor $args = apply_filters('coursepress_element_editor_args', $args, $editor_name, $editor_id); wp_editor($editor_content, $editor_id, $args); ?> </td> </tr> </tbody> </table> </div> <!--/inside--> </div><!--/postbox--> <?php