Created
June 7, 2016 16:09
-
-
Save cartpauj/b27d29dd9b222427c483a72683f0fff2 to your computer and use it in GitHub Desktop.
WP Autoembed MemberPress thank you page messages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Enter Your Custom Functions Here */ | |
function mepr_autoembed_thankyou_message($message) { | |
global $wp_embed; | |
if(!class_exists('MeprTransaction')) { return $message; } | |
if(!isset($_REQUEST['trans_num'])) { return $message; } | |
$txn = new MeprTransaction(); | |
$data = MeprTransaction::get_one_by_trans_num($_REQUEST['trans_num']); | |
$txn->load_data($data); | |
if(!$txn->id || !$txn->product_id) { return $message; } | |
$product = $txn->product(); | |
if($product->ID === null || !$product->thank_you_page_enabled || empty($product->thank_you_message)) { | |
return $message; | |
} | |
$message = stripslashes($product->thank_you_message); | |
$message = wpautop($wp_embed->autoembed($message)); | |
$message = do_shortcode($message); | |
if(class_exists('MeprHooks')) { | |
MeprHooks::do_action('mepr-thank-you-page', $txn); | |
} | |
return '<div id="mepr-thank-you-page-message">'.$message.'</div>'; | |
} | |
add_filter('mepr_custom_thankyou_message', 'mepr_autoembed_thankyou_message'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This looks like something I might enjoy, I just can't quite put my finger on exactly what its supposed to do or how I should use it. Can you shed some light on this for me. Thanks
I'm looking for a way to create a custom page template for my MP Thank-You page and choose to put the custom TY message into a tabbed box. Any thoughts?