Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating custom tab with ultimatemember plugin of wordpress

I've been trying to create a custom tab for my website and am using UltimateMember plugin.

After bit of google I found some code snippet that can help me do it:

First we need to extend main profile tabs

add_filter('um_profile_tabs', 'add_custom_profile_tab', 1000 );
function add_custom_profile_tab( $tabs ) {

 $tabs['mycustomtab'] = array(
  'name' => 'My custom tab',
  'icon' => 'um-faicon-comments',
 );

 return $tabs;

}

Then we just have to add content to that tab using this action

add_action('um_profile_content_mycustomtab_default', 'um_profile_content_mycustomtab_default');
function um_profile_content_mycustomtab_default( $args ) {
 echo 'Hello world!';
}

But my question, to what file should I add this code to achieve what I need. It sounds very numb of me to ask this, but I'm seriously confused.

Thanks for any help.

like image 803
Jigar Tank Avatar asked Apr 05 '16 12:04

Jigar Tank


1 Answers

Let me share my similar experience. First of all in this code :

$tabs['mycustomtab'] = array(
  'name' => 'My custom tab',
  'icon' => 'um-faicon-comments',
 );

You should use always

mycustomtab

as key which I see you've already used. So that's true. Generally it works out when you put this code in your active theme's functions.php But if it doesn't work out, consider adding this to core file um-filters-misc.php in the plugin core file folder for ultimate-member. Let me know if it works for you.

like image 88
Kinjal Tank Avatar answered Oct 02 '22 01:10

Kinjal Tank