Forked from ultimatemember/gist:f7eab149cb33df735b08
Last active
September 3, 2015 06:18
-
-
Save PrafullaKumarSahu/c16fceecf4e117e6e1cb to your computer and use it in GitHub Desktop.
Extend Ultimate Member Account page with custom tabs/content
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
/* add new tab called "mytab" */ | |
add_filter('um_account_page_default_tabs_hook', 'my_custom_tab_in_um', 100 ); | |
function my_custom_tab_in_um( $tabs ) { | |
$tabs[800]['mytab']['icon'] = 'um-faicon-pencil'; | |
$tabs[800]['mytab']['title'] = 'My Custom Tab'; | |
$tabs[800]['mytab']['custom'] = true; | |
return $tabs; | |
} | |
/* make our new tab hookable */ | |
add_action('um_account_tab__mytab', 'um_account_tab__mytab'); | |
function um_account_tab__mytab( $info ) { | |
global $ultimatemember; | |
extract( $info ); | |
$output = $ultimatemember->account->get_tab_output('mytab'); | |
if ( $output ) { echo $output; } | |
} | |
/* Finally we add some content in the tab */ | |
add_filter('um_account_content_hook_mytab', 'um_account_content_hook_mytab'); | |
function um_account_content_hook_mytab( $output ){ | |
ob_start(); | |
?> | |
<div class="um-field"> | |
<!-- Here goes your custom content --> | |
</div> | |
<?php | |
$output .= ob_get_contents(); | |
ob_end_clean(); | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment