Created
October 3, 2015 08:29
-
-
Save isaumya/c4e293b845ab53875970 to your computer and use it in GitHub Desktop.
Showing EDD Review Post link
This file contains 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
/*Add option to post review for edd purchased items - TH */ | |
add_action( 'edd_purchase_history_header_after', '__edd_post_review_th', 12 ); | |
function __edd_post_review_th() { | |
echo '<th class="edd-post-review-th">'. __('Reviews', 'edd') .'</th>'; | |
} // This part is working fine | |
/*Add option to post review for edd purchased items - TD */ | |
add_action( 'edd_purchase_history_row_end', '__edd_post_review_td', 12, 2 ); | |
function __edd_post_review_td( $payment_id, $purchase_data ) { | |
// As I'm getting payment id and not post id so I have no idea how to fetch | |
// the post id from payment id because I've to pass post id into get_permalinks() | |
// and I've tried to fetch the post ids from download_meta but it didn't work and I screwed up | |
// So, if you can help me out with this few linne of code it will be really helpful | |
$permalink = get_permalink(); | |
echo '<td class="edd-post-review-td"><a href="' . $permalink . '" title="Post Review">'. __('Post Review', 'edd') .'</a></td>'; | |
} | |
//------------------------ END of the Review Unit --------------------- | |
// I've been also trying to create my own EDD Emaqil template TAG for the list of post so that users can review then | |
// directly from their email but again I got stuck at the same place | |
// see below | |
/** | |
* Add a {ip_address} tag for use in either the purchase receipt email or admin notification emails | |
*/ | |
if ( function_exists( 'edd_add_email_tag' ) ) { | |
edd_add_email_tag( 'review_url', 'URL of the product so that the user can post review', '__get_product_url' ); | |
} // This part is ok - no issue | |
/** | |
* The {ip_address} email tag | |
*/ | |
function __get_product_url( $payment_id ) { | |
// Again here I have no idea how to fetch the list of actual product page | |
// hyperlinked to the page url e.e. Example Product which will be hyperlinked to the example product link | |
// I've tried a few things found on internet and none of them worked. So, if you can just help me out fetching the | |
// product page names with url I can fix this thing | |
$meta = get_post_meta ($payment_id, ‘_edd_payment_meta’, true); | |
$downloads = unserialize($meta[‘downloads’]); | |
return edd_get_payment_user_ip( $payment_id ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment