Skip to content

Instantly share code, notes, and snippets.

@BoweFrankema
Created February 20, 2015 15:43
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BoweFrankema/685d5a52ef98a29cdc6a to your computer and use it in GitHub Desktop.
Save BoweFrankema/685d5a52ef98a29cdc6a to your computer and use it in GitHub Desktop.
BuddyPress Easy Digital Downloads - My Purchases Page
<?php
if ( function_exists( 'bp_is_member' ) ) {
/**
* Add EDD Purchases Page
*
*/
function edd_bp_setup_purchases(){
global $bp;
$profile_link = bp_loggedin_user_domain() . $bp->profile->slug . '/';
$args = array(
'name' => __('My Purchases','cfctranslation'),
'slug' => 'my-purchases',
'parent_url' => $profile_link,
'parent_slug' => $bp->profile->slug,
'screen_function' => 'screen_edd_purchases',
'user_has_access' => ( bp_is_my_profile() || is_super_admin() ),
'position' => 40
);
bp_core_new_subnav_item($args);
}
add_action( 'bp_setup_nav', 'edd_bp_setup_purchases' );
function screen_edd_purchases(){
global $bp;
add_action( 'bp_template_title', 'edd_bp_page_title');
add_action( 'bp_template_content', 'edd_bp_page_content');
bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
}
function edd_bp_page_title(){
echo __('Your Purchases','cfctranslation');
}
function edd_bp_page_content(){?>
<div id="edd-my-purchases">
<?php
echo do_shortcode('[purchase_history]');
?>
</div>
<?php
}
function setup_edd_purchases () {
if ( !is_admin() ) {
add_action( 'bp_xprofile_setup_nav', 'edd_bp_setup_purchases' );
}
}
add_action('wp', 'setup_edd_purchases');
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment