Created
October 4, 2013 15:37
-
-
Save pippinsplugins/6827946 to your computer and use it in GitHub Desktop.
Show a message to users that have purchased the currently viewed product in EDD.
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
<?php | |
/** | |
* Show Has Purchased Item Message | |
* | |
* Prints a notice when user has already purchased the item. | |
* | |
* @since 1.0 | |
* @global $user_ID | |
* @param int $download_id Download ID | |
* @return void | |
*/ | |
function pw_edd_show_has_purchased_item_message() { | |
global $user_ID, $post; | |
if( !isset( $post->ID ) ) | |
return; | |
if ( edd_has_user_purchased( $user_ID, $post->ID ) ) { | |
$alert = '<p class="edd_has_purchased">' . __( 'You have already purchased this item, but you may purchase it again.', 'edd' ) . '</p>'; | |
echo apply_filters( 'pw_edd_show_has_purchased_item_message', $alert ); | |
} | |
} | |
add_action( 'edd_after_download_content', 'edd_show_has_purchased_item_message' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment