add_action( 'init', function() {
$endpoint_name = 'my-collections';
add_rewrite_endpoint( $endpoint_name, EP_PAGES );
});
add_filter( 'woocommerce_account_menu_items', function( $items ) {
$appear_after = 'orders';
$endpoint_name = 'my-collections';
$menu_item_label = 'My Collections';
$position = array_search( $appear_after, array_keys( $items ) ) + 1;
$items = array_slice( $items, 0, $position, true ) + array( $endpoint_name => $menu_item_label ) + array_slice( $items, $position, count( $items ) - 1, true ) ;
return $items;
});
add_action( 'woocommerce_account_my-collections_endpoint', function() {
?>
<h3>My Collections</h3>
<h4>Please approve the following collections:</h4>
<?php echo do_shortcode( '[picu_list_collections current_user status="sent"]<p>No collections to approve.</p>[/picu_list_collections]' ); ?>
<hr />
<h4>You have already approved the following collections:</h4>
<?php echo do_shortcode( '[picu_list_collections current_user status="approved"]<p>You do not have any approved collections.</p>[/picu_list_collections]' ); ?>
<hr />
<h4>Download your final images:</h4>
<?php echo do_shortcode( '[picu_list_collections current_user status="delivered"]<p>Currenlty there are no downloads available.</p>[/picu_list_collections]' ); ?>
<?php
});
Code language: PHP (php)