@sbrajesh I actually managed to finish half the work!
The plugin terawallet appears to have a short code to display the plugin functionality in any page (not just my account), so I wrote the following code to create a new tab for the wallet, feel free to use it.
You only need to replace the statics here such as title and tab order with your plugin variables.
The 2nd part is redirects which I believe would be very easy for you to finish, feel free to use the code!
function profile_tab_terawallet() {
global $bp;
bp_core_new_nav_item( array(
'name' => 'My Wallet',
'slug' => 'wallet',
'screen_function' => 'wallet_screen',
'position' => 107, //you can make this a variable in your plugin
'parent_url' => bp_loggedin_user_domain() . '/wallet/',
'parent_slug' => $bp->profile->slug,
'default_subnav_slug' => 'wallet'
) );
}
add_action( 'bp_setup_nav', 'profile_tab_terawallet' );
function wallet_screen() {
// Add title and content here - last is to call the members plugin.php template.
add_action( 'bp_template_title', 'wallet_title' );
add_action( 'bp_template_content', 'wallet_content' );
bp_core_load_template( 'buddypress/members/single/plugins' );
}
function wallet_title() {
echo 'My Wallet';
}
function wallet_content() {
echo do_shortcode( '[woo-wallet]' );
}
EDIT: used echo do_shortcode( ‘[woo-wallet]’ ); instead of echo ‘[woo-wallet]’ and everything works fine.
-
This reply was modified 5 years, 1 month ago by Ward.