Created
June 6, 2020 07:40
-
-
Save champsupertramp/82f7f6d3324501bc368413d6dc571b66 to your computer and use it in GitHub Desktop.
Ultimate Member - Custom Profile tab with custom link
This file contains hidden or 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 | |
/** | |
* Add a new Profile tab with custom link | |
* @param array $tabs | |
* www.champ.ninja | |
* @return array | |
*/ | |
function um_mycustomtab_add_tab( $tabs ) { | |
$tabs[ 'mycustomtab' ] = array( | |
'name' => 'My Custom', | |
'icon' => 'um-faicon-pencil', | |
'custom' => true | |
); | |
UM()->options()->options[ 'profile_tab_' . 'mycustomtab' ] = true; | |
add_filter('um_profile_menu_link_mycustomtab', function( $link ){ | |
if( class_exists('WC_Product_Vendors_Utils') ){ | |
$vendor_id = WC_Product_Vendors_Utils::get_user_active_vendor( get_requested_user() ); | |
return get_the_permalink( $vendor_id ); | |
} | |
return $link; | |
}); | |
return $tabs; | |
} | |
add_filter( 'um_profile_tabs', 'um_mycustomtab_add_tab', 1000 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment